nginx/0.8.54 - 502 Bad Gateway

nginxn00b nginx-forum at nginx.us
Wed Jul 20 13:43:14 UTC 2011


Hi,

I'm running nginx as a reverse proxy for a jetty. I host a Liftweb App
on localhost:8080. Nginx is listening on Port 81.

Here is my nginx.conf:

server {
                listen 81;
                server_name mysite.com www.mysite.com;

                location / {
                        proxy_pass http://127.0.0.1:8080;
                        proxy_set_header  X-Real-IP  $remote_addr;
                        proxy_read_timeout 700;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
                }
        }
 
When I try to point my browser to mysite.com:81 I always get a 502 Bad
Gateway message. I checked the log and found this:

connect() failed (111: Connection refused) while connecting to upstream,
client: 12.34.567.890, server: mysite.com, request: "GET /favicon.ico
HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host:
"mysite.com:81" 

Does this means this port is blocked? I tried other but the result is
still the same...

My hosting company gave me the advice better not to use port 80 (i'm in
china) and use some socket instead. I don't know what they mean by that.
I use port 81 for nginx now. Anyone an idea what they could mean by "use
sockets"? I read somewhere that i can later forward all traffic from 81
to port 80.

Any hints a very much appreciated.
Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,212680,212680#msg-212680




More information about the nginx mailing list