Nginx Proxy Manager无法代理同VPS本地应用求助
问题:Nginx Proxy Manager代理本地.NET Core应用出现502错误
环境与现状
- 已在Oracle Cloud的Ubuntu VPS上通过默认Docker Compose部署Nginx Proxy Manager(NPM),可通过公网IP+81端口正常访问管理后台并创建代理主机
- VPS上运行着一个.NET Core Web应用,以服务形式启动,监听地址为
127.0.0.1:5050;在VPS本地执行curl http://localhost:5050或curl http://127.0.0.1:5050可正常获取页面内容,但使用VPS私有IP或主机名执行curl http://{private_ip}:5050或curl http://{hostname}:5050时提示连接拒绝 - 此前使用原生Nginx配置可成功实现该应用的代理,配置片段如下:
server_name test.example.com; location / { proxy_pass http://127.0.0.1:5050/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; }
操作步骤与问题
- 在DNS服务商处将
test.example.com解析至VPS公网IP - 在NPM中创建代理主机:域名设置为
test.example.com,协议选择http,转发地址先后尝试过localhost、127.0.0.1、VPS私有IP、主机名,转发端口均设为5050 - 访问
test.example.com时,始终返回**502 Bad Gateway(openresty)**错误
疑问
- NPM是否支持代理同VPS上的本地应用?
- 是否是对NPM与Docker网络的理解存在偏差?
内容的提问来源于stack exchange,提问作者Telstar
相关产品推荐
相关产品推荐

