1 选择php+nginx版本
2 配置端口域名
3 重写url
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
4 运行以及编辑运行配置文件
Cmd进入php目录 php-cgi.exe -b 127.0.0.1:9000 -c php.ini
或者也可以利用脚本来实现 RunHiddenConsole.exe
@1 RunHiddenConsole.zip包解压到nginx目录内
@2 新建文件start_nginx.bat
@echo off
REM Windows 下无效
REM set PHP_FCGI_CHILDREN=5
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS=1000
echo Starting PHP FastCGI...
RunHiddenConsole D:/phpstudy/PHPTutorial/php/php-5.6.27-nts/php-cgi.exe -b 127.0.0.1:9000 -c D:/phpstudy/PHPTutorial/php/php-5.6.27-nts/php.ini
echo Starting nginx...
RunHiddenConsole D:/phpstudy/PHPTutorial/nginx/nginx.exe -p D:/phpstudy/PHPTutorial/nginx
@3 新建文件stopt_nginx.bat
@echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
exit
@4 双击start_nginx.bat看看进程管理器 nginx.exe进程 php-cgi.exe进程