然后访问
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吗
15 回答8.4k 阅读
2 回答2.4k 阅读✓ 已解决
1 回答1.8k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
3 回答872 阅读
1 回答773 阅读
1 回答585 阅读
因为
/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