Nginx | location 和 proxy_pass路径配置总结
Nginx的配置中,一个/可能导致巨大的差异。
找到了一篇特别详细的博客,传送门。
博客总结如下:
访问的URL都是test.com/user/test.html,upstream都是test1。
| 序号 | location配置 | proxy_pass配置 | 后端接收的请求 |
|---|---|---|---|
| 1 | /user/ | http://test1/ | /test.html |
| 2 | /user/ | http://test1 | /user/test.html |
| 3 | /user | http://test1 | /user/test.html |
| 4 | /user | http://test1/ | //test.html |
| 5 | /user/ | http://test1/haha/ | /haha/test.html |
| 6 | /user/ | http://test1/haha | /hahatest.html |
这玩意……用脑子真记不下来……放博客用到了查一下吧。