在lnmp环境中布置thinkphp 默认不支持pathinfo  的

在nginx.conf文件中的server中更改如下

        #include enable-php.conf; #布置下面的支持pathinfo一定要注释掉这行
        
        #新增
         include enable-php-pathinfo.conf; #这一句支持pathinfo  当然有这个enable-php-pathinfo.conf配置文件才行

 

enable-php-pathinfo.conf;
复制代码
        location ~ [^/]\.php(/|$)
        {
              # comment try_files $uri =404; to enable pathinfo  
            #try_files $uri =404;  
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            include pathinfo.conf;
        }
复制代码
pathinfo.conf
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO       $path_info;
try_files $fastcgi_script_name =404;

 

posted on 2020-05-14 11:00  草根920  阅读(204)  评论(0编辑  收藏  举报