现在部署了一个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;}但是似乎没有用........不知道何解各位还请帮忙看看谢谢!
2 回答
弑天下
TA贡献1818条经验 获得超8个赞
使用try_files$uri$uri//;location/{proxy_passhttp://localhost:6666;proxy_set_headerHost$host:$server_port;proxy_set_headerX-Real-IP$remote_addr;client_max_body_size10m;try_files$uri$uri//;}
烙印99
TA贡献1829条经验 获得超13个赞
试试去掉后面的proxy_pass后面的/admin/location^~/admin/{proxy_passhttp://localhost:6666;proxy_set_headerHost$host:$server_port;proxy_set_headerX-Real-IP$remote_addr;client_max_body_size10m;}
添加回答
举报
0/150
提交
取消
