根目录访问php 404,nginx配置后只有根目录首页index.php能访问,其他页面404
生活随笔
收集整理的这篇文章主要介绍了
根目录访问php 404,nginx配置后只有根目录首页index.php能访问,其他页面404
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
我本地是window系统,用的是phpstudy,解决办法:用phpstudy点击其他选项菜单->打开配置文件->选择vhost-ini(或者找到nginx安装目录,打开vhost.conf),在你的站点配置里
location / {
index index.html index.htm index.php;
#autoindex on;
}
改为
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
#autoindex on;
}
最后重启nginx,就搞定了。
原文:https://www.cnblogs.com/xiesx/p/11375779.html
总结
以上是生活随笔为你收集整理的根目录访问php 404,nginx配置后只有根目录首页index.php能访问,其他页面404的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 急性咽喉炎吃什么药好得快?
- 下一篇: 麸炒僵蚕的功效与作用、禁忌和食用方法