Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想设置我的 Nginx 服务器
/app/portnum
类型 URL 被反向代理到
localhost:portnum
例如
/app/1234
将被反向代理为
localhost:1234
这可能会有所帮助:
server { listen 80; server_name test1.test.com; location ~ ^/app/(.*)$ { proxy_pass http://192.168.154.102:$1; } }
注意:如果你访问test1.test.com/app/8081,nginx会将请求传递给http://192.168.154.102:8081/app/8081。
test1.test.com/app/8081
http://192.168.154.102:8081/app/8081
有关proxy_pass的更多信息