現在部署了一個web,本機地址是localhost:6666/blogs/user然后利用nginx反代配置如下:upstreammyweb{serverlocalhost:6666;}server{listen80;server_namemyhost.net;indexindex.phpindex.htmlindex.htmdefault.phpdefault.htmdefault.html;root/www/wwwroot/host.net;location/{proxy_passhttp://localhost:6666/blogs/user/;proxy_set_headerHost$host:$server_port;proxy_set_headerX-Real-IP$remote_addr;client_max_body_size10m;}這樣配置后可以訪問,然而又發現一個問題是這個web還有一個路由是localhost:6666/admin我按照搜出來的方法又加了一個配置如下:location^~/admin/{proxy_passhttp://localhost:6666/admin/;proxy_set_headerHost$host:$server_port;proxy_set_headerX-Real-IP$remote_addr;client_max_body_size10m;}但是似乎沒有用........不知道何解各位還請幫忙看看謝謝!
Nginx 反向代理整站與指定目錄問題
慕工程0101907
2019-05-23 19:13:53