Nginx gives 502 Bad Gateway when proxying to nodejs app running on ... | nginx 502 bad gateway docker
Iamusingdockercomposetocreate2containersoneforapplicationrunningonNginxandanotherforbackendapplicationonNodejs(runningonanotherport4000)withroutesofpatterns“/org-metadata/,/proxy-api/,/node-api/**”.Iamtryingtoproxythenginxtonodejsrunningon4000,butitdoesnotreachthebackend.andthenginxgivesthe502BadGatewayresponse.P.S:mynodeappgives503serviceunavailablewhenIrunitfrombrowser.CansomeoneplspointwhereamImissinganything?Hereismynginx.conffile:worker_processesauto;events{worker_connections8000;multi_...
I am using docker compose to create 2 containers one for application running on Nginx and another for backend application on Nodejs(running on another port 4000) with routes of patterns “/org-metadata/, /proxy-api/, /node-api/**”.
I am trying to proxy the nginx to nodejs running on 4000, but it does not reach the backend. and the nginx gives the 502 Bad Gateway response.
P.S: my node app gives 503 service unavailable when I run it from browser.
Can some one pls point where am I missing anything?
Here is my nginx.conf file:
worker_processes auto; events { worker_connections 8000; multi_accept on; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /dev/stdout; error_log /dev/stderr; upstream backend { server 127.0.0.1:4000; } server { listen 80; root /var/www; index index.html index.htm; location / { ...