I have 2 separate Docker containers: Node app and Nginx running locally on a Windows machine. Both containers are up and running but I am unable to access my Node app via reverse proxy that I have set up in Nginx:
Node app container is ruuning using below command:
docker run -p 2020:2020 --name nodeapp myimage:1.0
Node app is accessible at localhost:2020 url
For the Nginx container I am using
docker run -p 7070:80 --name nginx mynginx:1.0
Nginx is accessible at localhost:7070
Below is my nginx configuration file:
default.conf
upstream nodeserver {
server 127.0.0.1:2020;
}
server {
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded_Proto $scheme;
proxy_pass http://nodeserver;
}
}
What am I doing wrong?