凌的博客

您现在的位置是: 首页 > 学无止境 > PHP > 

PHP

lnmp不支持pathinfo模式的解决办法

2015-04-08 PHP 684
1. touch /usr/local/nginx/conf/pathinfo.conf 创建pahtinfo.conf文件 2. vi /usr/local/nginx/conf/pathinfo.conf set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~

1. touch /usr/local/nginx/conf/pathinfo.conf

创建pahtinfo.conf文件

2.

vi /usr/local/nginx/conf/pathinfo.conf
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;


再将虚拟主机配置文件里的location ~ .*\.(php|php5)?$ 替换为:location ~ .*\.php

再在include fcgi.conf; 下面添加一行include pathinfo.conf;

保存退出;
3.
vi /usr/local/php/etc/php.ini

将cgi.fix_pathinfo=0 修改为cgi.fix_pathinfo=1

保存退出;
重启LNMP服务,/root/lnmp restart

即可支持;

文章评论

0条评论