首页 > Web开发 > 详细

nginx配置后只有根目录首页index.php能访问,其他页面404

时间:2019-08-19 12:25:10      阅读:548      评论:0      收藏:0      [点我收藏+]

我本地是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,就搞定了。

nginx配置后只有根目录首页index.php能访问,其他页面404

原文:https://www.cnblogs.com/xiesx/p/11375779.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!