2

Can't figure out why I keep getting 502 bad gateway nginx error.

Here is the error from nginx error log.

2012/12/03 19:30:21 [error] 20650#0: *939328 connect() failed (111: Connection refused) while connecting to upstream, client: 70.94.18.35, server: demo.domain.com, request: "GET /assets/js/msgFBmodal.js HTTP/1.1", upstream: "http://108.166.94.94:7080/assets/js/msgFBmodal.js", host: "demo.domain.com", referrer: "http://demo.domain.com/register/user_profile"

I'm on a rackspace cloud sever, CentOS.

Alois Mahdal
  • 10,763
  • 7
  • 51
  • 69
Nathan
  • 31
  • 1
  • 1
  • 5

4 Answers4

2

I hit the same problem, in my case, it was the firewall port which needed to be opened.

Please check your firewall / a firewall ahead of your machine that could be refusing the connection.

cyberjar09
  • 770
  • 1
  • 7
  • 18
2

Check if your upstream address works correct (in your case 108.166.94.94:7080/assets/js/msgFBmodal.js). If everything fine then try to see packets from nginx to upstream for example like this

sudo ngrep -q -d eth0 -W byline port 7080
0

I also faced the same problem, it was because i didn't install php on my nginx server

By installing php-fpm this problem was totally solved. it is just the same thing as php fastcgi but with lots of configuration options and advantages

you can know more about php-fpm form here!

or You can follow this question!

Community
  • 1
  • 1
Abhishek Tripathi
  • 1,570
  • 3
  • 20
  • 32
0

I was following a tutorial on uwsgi and nginx and I kept having this same message and failure, but my problem was because the initial starting directory that I thought was set was not due to a no longer working config option, and my unix socket was being put (or attempted to put) in / directory. When I put the full path for my socket in the .ini config file it worked fine. yeeeargh that's a night I'll never get back :D

like this [uwsgi] .... socket = /var/www/stage/deeznts.sock

Chris Wood
  • 63
  • 1
  • 5