lnmp环境 thinkphp nginx下配置支持pathinfo

1、首先修改php.ini文件。

搜索并设置 cgi.fix_pathinfo=1

2、更改nginx配置

server {
    listen        80;
    server_name   xxx.xxxx.com;
    root          /home/wwwroot/xxx;
    index         index.html index.htm index.php;
	
	location / {
		if (!-e $request_filename){
			rewrite ^/(.*)$ /index.php/$1 last;
			break;
		}
	}  
	
	#include enable-php.conf;
	include  enable-php-pathinfo.conf;
}
3、重启php-fpm、nginx即可正常访问页面。
发布了21 篇原创文章 · 获赞 3 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/zchare/article/details/81060689