2018年3月17日 星期六

Nginx + PHP + Windows


=======================
PHP5

OS: Windows 10 Home

download  nginx (windows)
https://nginx.org/en/download.html

download php5  (stable)
https://windows.php.net/download#php-5.6

Key: 如何連結 nginx 與 php5 ?

Php5 :  利用 php-cgi.exe 執行以下命令
php-cgi -b 9000

nginx: 設定檔修改   /conf/nginx.conf

1. 將以下的code 前面的 #  移除,使他們不再是註解
2. 修改  fastcgi_param 參數中的  /scripts   改為 $document_root


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;
}


在nginx.exe 目錄下執行以下命令  例如C:\code\nginx\nginx-1.12.2
start nginx

如果要重讀取設定檔
nginx -s reload

如果要停止server     
nginx -s stop


參考
http://nginx.org/en/docs/windows.html



=======================
PHP7

download php7  (stable)
https://windows.php.net/download#php-7.2

如上

=======================

可能問題
nginx 可能多重啟動,所以不能確定是跑那一個!?




砍光,重啟才能確定。


沒有留言:

張貼留言