PHP window环境配置nginx

2024-01-10 10:23:58

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版本等等,以此类推。

文章来源:https://blog.csdn.net/weixin_51957364/article/details/135403281
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。