現(xiàn)在部署了一個(gè)web,本機(jī)地址是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;}這樣配置后可以訪問(wèn),然而又發(fā)現(xiàn)一個(gè)問(wèn)題是這個(gè)web還有一個(gè)路由是localhost:6666/admin我按照搜出來(lái)的方法又加了一個(gè)配置如下:location^~/admin/{proxy_passhttp://localhost:6666/admin/;proxy_set_headerHost$host:$server_port;proxy_set_headerX-Real-IP$remote_addr;client_max_body_size10m;}但是似乎沒(méi)有用........不知道何解各位還請(qǐng)幫忙看看謝謝!
Nginx 反向代理整站與指定目錄問(wèn)題
慕工程0101907
2019-05-23 19:13:53