Friday, August 22, 2014

NGINX Proxy Pass to NodeJS App: Returning 502 error

I'm trying to setup NGINX as the frontend of my NodeJS app, which is live on 127.0.0.1:3000, but i can't resolve this 502 error. NGINX is locally reachable at http://55.55.55.5/ or http://dev.example



dev.example (file in: /etc/nginx/sites-available and symlinked to sites-enabled)



upstream up_dev.example {
server 127.0.0.1:3000;
}


server {
listen 0.0.0.0:80;
server_name dev.example example;
access_log /var/log/nginx/dev.example.log;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;

proxy_set_header X-NginX-Proxy true;

proxy_pass http://up_dev.example/;
proxy_redirect off;
}
}


error.log





2014/09/17 19:38:26 [error] 1679#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 55.55.55.1, server: , request: "GET / HTTP/1.1", upstream:$


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...