I get an 5#5: *23 upstream timed out (110: Connection timed out) while connecting to upstream, client:
error with nginx.
I have read and applied the Nginx reverse proxy causing 504 Gateway Timeout question. However my case sligthly different, because I have three endpoint to proxy.
My nginx.conf:
worker_processes 1;
events { worker_connections 1024; }
http {
server {
listen 80;
listen [::]:80;
server_name rollcall;
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass "http://[hostip]:8080/api";
}
location /api/attendance {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass "http://[hostip]:8000/api";
}
location / {
include /etc/nginx/mime.types;
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
My "/" and the application with port:8080 proxy as they are expected, however my application with port:8000 does not proxy, and get the above mentioned timeout exception. If I try to request the application with the port:8000, the application works as expected.
What could cause the above described timeout, and how I should change my conf file?
The problem was not a Nginx or Docker related problem. The port 8000 was not opened on the application droplet.