我的nginx有个问题:
当我的用户搜索"hermes.my-domain.com“时,<#>I必须将所有http和https流量重定向到我的应用程序所在的5000端口。
"hermes“是我的子域名。
所以我就这么做:
server {
listen 80;
server_name hermes.my-domain.com;
return 301 https://hermes.my-domain.com$request_uri;
}
server {
listen 443;
ssl_certificate /etc/certs/ssl/bundle.crt;
ssl_certificate_key /etc/certs/ssl/server.key;
location / {
proxy_pass http://localhost:5000;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
}
}每次我跌倒在502错误上。
我不明白发生了什么..。
如果有人知道问题的话?
非常感谢!
这是我从error.log得到的结果:
很抱歉,这是我从error.log得到的结果:
2021/11/24 09:09:44 [error] 19384#19384: *332 connect() failed (111: Connection refused) while connecting to upstream, client: 10.10.1.158, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "hermes.my-domain.com"
2021/11/24 09:09:44 [error] 19384#19384: *332 connect() failed (111: Connection refused) while connecting to upstream, client: 10.10.1.158, server: , request: "GET / HTTP/1.1", upstream: "http://[::1]:5000/", host: "hermes.my-domain.com"
2021/11/24 09:09:44 [error] 19384#19384: *332 no live upstreams while connecting to upstream, client: 10.10.1.158, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://localhost/favicon.ico", host: "hermes.my-domain.com", referrer: "https://hermes.my-domain.com/"谢谢你们的帮助!
发布于 2021-11-24 09:03:10
您的应用程序服务器没有监听端口5000。
connection refused表示该接口上的端口上没有监听任何内容。
ss -tnlp |grep :5000的空输出确认没有监听该端口。
如果您的应用服务器确实在运行,请检查它的配置是否正确。如果没有运行,就启动它。
https://serverfault.com/questions/1084336
复制相似问题