一聚教程网:一个值得你收藏的教程网站

热门教程

解决nginx 不支持 PATH_INFO的方法

时间:2022-06-30 19:00:32 编辑:袖梨 来源:一聚教程网

 代码如下 复制代码

server {
     listen 80;
     server_name www.sample.com;
     root /www;
     index index.php index.html;
     location / {
         index index.php index.html index.htm;
         include /www_rewrite/.htaccess;
     }  
     location ~ .php($|/) {
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;
         fastcgi_buffers 8 128k;
         send_timeout 60;
         include /etc/nginx/fastcgi_params;
 
         set $script_name $fastcgi_script_name;
         set $path_info "";
         if ($uri ~ "^(.+?.php)(/.*)$") {
                set $script_name $1;
                set $path_info $2;
         }  
         fastcgi_param PATH_INFO $path_info;
         fastcgi_param SCRIPT_NAME $script_name;
     }  
 }

编写上面程序之后我们的nginx就支持了path_info了,有需要的朋友可以参考一下。

热门栏目