1 zingl 2016-02-04 17:01:26 +08:00 先后顺序换一下试试 |
![]() | 2 lhbc 2016-02-04 17:56:14 +08:00 location = / { root /www/main; index index.html; } location = /index.html { root /www/main; index index.html; } location / { proxy_pass http://xx.xx.xx.xx:20002; } |
![]() | 3 lhbc 2016-02-04 18:03:19 +08:00 还是建议把后端的路径改为 location ^/xxx/ 这样的,否则以后很蛋疼。 比如你要增加一个静态文件,怎么办? 只把 /xxx/ 反代给后端,其它 URI 就随便你用了。 用 try_files 也可以达到这个效果,不过安全性不及上面的方法好,因为任何不存在的文件都提交给后端处理了。 |
![]() | 4 hayao650 OP OK,谢谢大家了,已将解决了,学习了,看来放假的时候要好好看看 nginx 文档了 |
![]() | 5 msg7086 2016-02-05 00:58:18 +08:00 try_files 似乎方便一些。 |