1、安裝 Nginx,
進入conf檔案夾配置nginx.conf 設定http 裡面server屬性
server {
listen 8079;
server_name localhost;
location / {
root e:/Nginx/web/;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#設定php-cgi模式
location ~ \.php$ {
root e:/Nginx/web/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
2、安裝php (cgi模式)~忽略
3、啟動環境
啟動Nginx:
taskkill /F /IM nginx.exe >nul
start E:\Nginx\nginx-1.8.0\nginx.exe
啟動Fastcgi
e:\Nginx\php5\php-cgi.exe -b 127.0.0.1:9000 -c e:\Nginx\php5\php.ini
可以RunHiddenConsole控制CMD命令列不顯示
再寫一個stop的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 Windows安裝),包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。