首页 > 解决方案 > 如何配置有关proxy_pass的nginx?

问题描述

我跑步tomcat,我nginx.conf喜欢这样 在此处输入图像描述

如果在http://127.0.0.1:8080/edu/b.htmlhttp://192.168.0.102:8080/edu/b.html没关系

如果http://192.168.0.102:9001/edu/b.html它不能工作

我现在的电脑ip是192.168.0.102

在此处输入图像描述

错误信息

[error] 17810#17810: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 192    .168.0.102, server: 192.168.0.102, request: "GET /edu/b.html HTTP/1.1", upstream: "http://127.0.0.1:8000/edu/b.html", host: "192.    168.0.102:9001"      

错误在哪里?我应该怎么办?

标签: nginxnginx-reverse-proxy

解决方案


它正在尝试连接到http://127.0.0.1:8000/edu/b.html(上游)而不是http://192.168.0.102:8080/edu/b.html. 您需要更改 nginx.conf 中的上游端口


推荐阅读