I've a problem with my nginx :
I have to redirect all the http and https traffic when my users search "hermes.my-domain.com" to the 5000 port, on my nginx serveur, where my app is.
"hermes" is the name of my sub-domain.
So I do that :
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;
}
}
Every time I fall on a 502 error.
I don't understand what's happen...
if someone know the problem please ?
Thank you very much !
This is my result from error.log :
My apologies, this is my result from 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/"
Thank you for your help all !