-->
[nginx] 2023-03-31 圈点809
摘要:windows中nginx安装使用fastcgi方式连接php
windows中nginx安装使用fastcgi方式连接php
逻辑思维:
先配置好PHP.ini;然后用php-cgi.exe 按端口启动;再配置nginx的配置文件使用php的fastcgi,并重新启动nginx即可。
1,配置,PHP.ini
搜索“cgi.force_redirect” ;cgi.force_redirect = 1 先去前面的分号再改为 cgi.force_redirect = 0
搜索“fastcgi.impersonate”,找到: ;fastcgi.impersonate = 1 去掉前面的分号
搜索“cgi.rfc2616_headers”,找到:;cgi.rfc2616_headers = 0 先去前面的分号再改为 cgi.rfc2616_headers = 1
其它配置按需正常
2,php-cgi.exe 按端口启动
e:/php/php-cgi.exe -b 127.0.0.1:9000 -c e:/php/php.ini
3,配置nginx的配置文件使用php的fastcgi
#location ~ \.php$ {
# root e:/wwwroot/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
#}
备注:
此设置在原配置文件中就有,只需要去掉前面的注释符号,并修改2个地方:
1)将root html;改为root e:/wwwroot/html; 即实现的网站根目录
2)把“/scripts”改为“$document_root”,这里的“$document_root”就是指前面“root”所指的站点路径.