Open dszymczuk opened 1 year ago
Hi, could you perhaps share relevant nginx logs? Seems like a common problem I also had before.
No more logs. Just what I pasted.
Are you sure? I mean the nginx webserver/container.
APP nginx access.log is empty. APP nginx error.log has:
2023/05/22 15:07:48 [notice] 1#1: using the "epoll" event method
2023/05/22 15:07:48 [notice] 1#1: nginx/1.24.0
2023/05/22 15:07:48 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
2023/05/22 15:07:48 [notice] 1#1: OS: Linux 4.19.0-10-amd64
2023/05/22 15:07:48 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/05/22 15:07:48 [notice] 1#1: start worker processes
2023/05/22 15:07:48 [notice] 1#1: start worker process 29
2023/05/22 15:07:48 [notice] 1#1: start worker process 30
NPM error.log:
2023/05/22 14:58:11 [notice] 411#411: signal process started
2023/05/22 14:58:12 [notice] 429#429: signal process started
2023/05/22 14:58:12 [notice] 441#441: signal process started
2023/05/22 14:58:55 [notice] 578#578: signal process started
2023/05/22 14:59:03 [notice] 611#611: signal process started
2023/05/22 14:59:39 [notice] 730#730: signal process started
2023/05/22 14:59:51 [notice] 775#775: signal process started
2023/05/22 14:59:51 [notice] 793#793: signal process started
2023/05/22 14:59:51 [notice] 808#808: signal process started
NPM Access log is not exist.
Sorry for the late response, but it's actually pretty simple. For the frontend you simply need to use port 80. You can remove the ports: part in your docker-compose.yml. since you got all the containers in one network :)
I commented out the port part and it works.
But why it doesn't work when I set 3000:80
and set in NPM to http://app-frontend:3000
?
I commented out the port part and it works. But why it doesn't work when I set
3000:80
and set in NPM tohttp://app-frontend:3000
?
That's because setting 3000:80 forwards the port to the network (e.g. 127.0.0.1:3000, could also be a home IP or external IP). If you want to use the port, you'd need to use your local ip. Generally tho, how you do it now, with seperate hostnames and ports, is the best approach since it secures the service itself by only allowing external traffic through thr reverse proxy. :D I hope that's understandable, feel free to ask if you have any further questions.
Issue is now considered stale. If you want to keep it open, please comment :+1:
Checklist
jc21/nginx-proxy-manager:latest
docker image?Describe the bug Got 502 error when made proxy from NPM to nginx.
Nginx Proxy Manager Version v2.10.2
To Reproduce Steps to reproduce the behavior:
Expected behavior
Make proxy for frontend app correctly.
Operating System Docker - Debian
Additional context
Application is accessible via port
8080
so nginx from frontend part works correctly.It looks like the problem is between NPM and nginx.
Error logs from NPM (IP 172.23.0.2 is frontend):
2023/05/07 08:45:59 [error] 9579#9579: *1174 connect() failed (111: Connection refused) while connecting to upstream, client: IP_CLIENT, server: krzysiek.dszymczuk.pl, request: "GET / HTTP/2.0", upstream: "http://172.23.0.2:8080/", host: "MYDOMAIN.COM", referrer: "http://MYDOMAIN.COM:8081/"
2023/05/07 08:46:00 [error] 9579#9579: *1174 connect() failed (111: Connection refused) while connecting to upstream, client: IP_CLIENT, server: MYDOMAIN.COM, request: "GET /favicon.ico HTTP/2.0", upstream: "http://172.23.0.2:8080/favicon.ico", host: "MYDOMAIN.COM", referrer: "https://MYDOMAIN.COM/"