PHPer 在window服务器里面配置nginx时,如果出现无法访问的情况(PS:几年前遇到的,忘记具体什么情况了。),可以尝试以下方法:
举个栗子:
如果php版本是7.1,则如下:
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:20071;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
如果php版本是7.2,则如下:
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:20072;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
如果php版本是7.3,则如下:
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:20073;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
总的来说,20073 对应的就是php7.3版本,20072 对应的就是php7.2版本,20071 对应的就是php7.1版本等等,以此类推。