根目录访问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的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 急性咽喉炎吃什么药好得快?
- 下一篇: 麸炒僵蚕的功效与作用、禁忌和食用方法