然后访问
http://127.0.0.1/xxxx 结果404,
然后看一下error日志,为什么去查找nginx-1.16.1/html/xxxx文件,不是nginx-1.16.1/xxxx/index.html吗
然后访问
http://127.0.0.1/xxxx 结果404,
然后看一下error日志,为什么去查找nginx-1.16.1/html/xxxx文件,不是nginx-1.16.1/xxxx/index.html吗
2 回答2.6k 阅读✓ 已解决
1 回答2k 阅读✓ 已解决
1 回答1.3k 阅读✓ 已解决
3 回答1.2k 阅读
2 回答640 阅读
1 回答857 阅读
1 回答459 阅读
因为
/xxxx
和/xxxx/
是不同的location。你得访问/xxxx/
才会命中你下面那个location,否则你得改成location /xxxx
而不是location /xxxx/
。改用
location /xxxx
的时候,访问/xxxx
nginx会给你返回一个301
,重定向到/xxxx/
你应该详细阅读下nginx的location指令的说明: http://nginx.org/en/docs/http...
如果想知道nginx是如何命中location的,可以使用
nginx-debug
命令启动nginx,然后查看error log