lnmp thinkphp在linux上支持pathinfo

在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 @ 2017-12-05 16:54  虚无缥缈的云  阅读(209)  评论(0编辑  收藏  举报