php Nginx 安裝手冊

2022-04-05 06:12:40 字數 1923 閱讀 9514

1、需要安裝的程式:

(1) http伺服器:nginx

(2) php開發環境:phpstorm

(3) php安裝環境:php

(4) 資料庫:postgresql

2、修改nginx/conf/nginx.conf 找到該段

#location ~ \.php$ {

#    root           html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  script_filename  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

修改為:

location ~ \.php$ {

root          html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  script_filename  $document_root$fastcgi_script_name;

include        fastcgi_params;

並修改include 為絕對路徑。列:  include   e:/nginx-1.15.7/conf/fastcgi_params

在nginx/html 目錄下新建index.php 內容如下

<?php

phpinfo();

php目錄下copy檔案 php.ini-development 修改為 php.ini

修改php.ini

(1)    ;extension_dir ="./ext"   取消注釋,並修改為絕對路徑 extension_dir ="e:/php/ext」

(2)    取消注釋 ;cgi.fix_pathinfo=1

(4)    新建start_php.bat,修改php_home 和 nginx_home

@echo off

set php_home=e:/php

set nginx_home=e:/nginx-1.15.7

rem windows 下無效

rem set php_fcgi_children=5

rem 每個程序處理的最大請求數,或設定為 windows 環境變數

set php_fcgi_max_requests=1000

echo starting php fastcgi...

runhiddenconsole %php_home%/php-cgi.exe -b 127.0.0.1:9000 -c %php_home%/php.ini

echo starting nginx...

runhiddenconsole %nginx_home%/nginx.exe -p %nginx_home%

(5)    新建stop_php.bat

@echo off

echo stopping nginx...

taskkill /f /im nginx.exe > nul

echo stopping php fastcgi...

taskkill /f /im php-cgi.exe > nul

exit

啟動nginx php: 點選 start_php.bat

停止 nginx php: 點選 stop_php.bat

成功後開啟http://localhost/index.php 顯示下面頁面

以後就可以在nginx/html目錄下直接放php了;

ubuntu簡易安裝php nginx

一 安裝php 1,通用安裝php,執行以下命令sudo apt get install php安裝php fpm 記住你安裝php fpm的版本sudo apt get install php fpm2,附帶php5.6安裝 root使用者登入,先執行以下命令 apt get update apt...

PHP nginx環境安裝部署

1.當前使用的原始碼為 2.configure configure prefix usr local php with curl with gd with gettext with kerberos with libdir lib64 with mysqli with openssl with pc...

yum方式安裝php nginx

yum install nginx 配置 etc nginx nginx.conf 常用命令 啟動systemctl start nginx 停止systemctl stop nginx 重啟systemctl restart nginx 平滑重啟 systemctl reload nginx1 新...