I agree with your statment
Nginx 502 Bad Gateway
-
Do you have this line in your
/etc/nginx/nginx.conf
?include /etc/nginx/sites-enabled/*;
Without it, nginx will not enter the
sites_enabled
folder at all to look for server configuration blocks -
@julian It has:
-
@Hentai To be honest -- everything looks good to me.
... I know you probably did it, but I have to ask -- did you restart nginx after you added the new server config?
-
@julian Yes, I have restart it, using
sudo service nginx restart
-
Does the huoshaolin file have permissions that are readable by the nginx user?
-
@julian I was created this file as root user...
-
@Hentai Run
ls -l
and inspect the permissions. There needs to be anr
in the third-last character:~ $ ls -l /etc/nginx/sites-available/localhost-nodebb -rw-r--r-- 1 root root 515 Mar 13 16:14 /etc/nginx/sites-available/localhost-nodebb
-
-
Then I am officially out of ideas
-
I was following this guide to install my Nginx:
But I didn't use a regular, non-root user to install it (I installed it using root user), maybe this is the problem ?
-
No, that shouldn't be a problem. The 502 error usually means a connection to the backend server could not be reached...
Either because no server block matched, or because the NodeBB process could not be proxied to...
Are you running NodeBB as root? I can't imagine that would break anything though...
-
@julian Yeah, I was start NodeBB in root:
-
Your nginx.conf matches mine. Can you post
sudo tail /var/log/nginx/error.log
? -
@Guiri Of course:
2014/07/09 01:13:17 [error] 8494#0: *26 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "huoshaolin.com"
2014/07/09 01:13:17 [error] 8494#0: *26 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "huoshaolin.com"
2014/07/09 01:17:47 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "www.huoshaolin.com"
2014/07/09 01:17:47 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "www.huoshaolin.com"
2014/07/09 01:17:50 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "www.huoshaolin.com"
2014/07/09 01:17:50 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "www.huoshaolin.com"
2014/07/09 01:17:52 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "www.huoshaolin.com"
2014/07/09 01:17:53 [error] 8494#0: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 113.109.53.7, server: huoshaolin.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "www.huoshaolin.com"
2014/07/09 01:26:43 [error] 8494#0: *38 connect() failed (111: Connection refused) while connecting to upstream, client: 107.178.200.63, server: huoshaolin.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "www.huoshaolin.com"
2014/07/09 01:26:45 [error] 8494#0: *40 connect() failed (111: Connection refused) while connecting to upstream, client: 107.178.200.63, server: huoshaolin.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "www.huoshaolin.com" -
@Hentai said:
proxy_pass http://127.0.0.1:4567/;
Try changing this to
proxy_pass http://huoshaolin.com:4567/;
-
-
Heh, I guess I did assume that nginx and NodeBB were on the same server
-
-
-
@julian I'm around, just trying to figure out my own apache configuration for what it's worth