nginx下ThinkPHP5.0路由无效

nginx下开启tp5的路由

由于nginx不支持pathinfo,导致TP5用路由访问时会报404。

解决办法,找到nginx下虚拟主机的配置文件,一般是在/usr/ local/ nginx/ conf/ vhost/ 域名.conf

在中间加上一段代码

location / { 
	if (!-e $request_filename) {
		rewrite  ^(.*)$  /index.php?s=$1  last;
		break;
	}
}

在这里插入图片描述

完美解决!

感谢大神的参考资料 http://www.9958.pw/post/nginx_config

猜你喜欢

转载自blog.csdn.net/weixin_44482156/article/details/86289274