I've been following this tutorial, and everything seems to run OK, except for my nginx setup. My node.js
application runs on port 1337, varnish runs on port 80, stunnel on 443 and nginx on 8080.
I can reach my app correctly when i specify the port https://example.com:1337
but all I get when visiting https://example.com
is a 502 Bad Gateway
error.
This is the output of my nginx log:
2012/08/25 14:13:59 [error] 6049#0: *1 no live upstreams while connecting to upstream, client: 127.0.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://app_example/", host: "example.com"
2012/08/25 14:14:02 [error] 6049#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:1337/", host: "example.com"
and this is my nginx config file for that domain:
upstream example.com {
server 127.0.0.1:1337;
}
server {
server_name example.com;
listen 8080;
location / {
proxy_pass http://example.com;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
I'm running:
- Ubuntu 12.04
- nginx/1.1.19
- stunnel 4.42
- varnish-3.0.2