我有一个运行在http:// localhost:8080的服务器,我希望该服务器的特定url由Nginx代理.
例如,我只希望将http:// localhost:8080 / test /(.*)反向代理到http:// localhost / test /(.*).
我正在将另一台服务器传播到http:// localhost /.
最佳答案
那只是一个简单的位置块呢?
server {
# ... other stuff
location /test/ {
try_files $uri @testproxy;
}
location @testproxy {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
# all your params
}
}
原文地址:https://www.jb51.cc/nginx/532421.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。