502 Bad Gateway Nginx


#1

hello i am really disappointed i try to run reaction on ubuntu 14.04 LTS with nginx. And i got 502 Bad Gateway

i check my app run as well but maybe i miss something.

root directory: var/www/reaction
[[[[[ /var/www/reaction ]]]]]

=> Started proxy.
=> A patch (Meteor 1.4.1.2) for your current release is available!
Update this project now with ‘meteor update --patch’.
=> Started MongoDB.
13:56:37.672Z INFO Reaction: Load default data from /private/data/
13:56:39.426Z INFO Reaction: JobServer started
13:56:39.478Z WARN Reaction: Skipped loading settings from reaction.json.
13:56:49.928Z INFO Reaction: Starting createDefaultAdminUser
13:56:49.943Z INFO Reaction: Not creating default admin user, already exists
13:56:49.956Z WARN Reaction: OpenExchangeRates API not configured. Not adding fetchRates job
13:56:49.964Z WARN Reaction: OpenExchangeRates API not configured. Not adding flushRates job
13:56:49.977Z INFO Reaction: Reaction.init() has run
13:56:49.978Z INFO Reaction: Reaction initialization finished.
=> Started your app.

=> App running at: http://localhost:3000/

My nginx file:
server {
listen 80;

   server_name demo.com;

root /var/www/reaction;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection ‘upgrade’;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

Thanks For your help


#2

Can you share your nginx logs?


#3

2016/10/16 14:01:52 [error] 4771#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:3000/”, host: "node.say-demo.com"
2016/10/16 14:01:53 [error] 4771#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://[::1]:3000/favicon.ico”, host: “node.say-demo.com”, referrer: "http://node.say-demo.com/"
2016/10/16 14:01:53 [error] 4771#0: *6 no live upstreams while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://localhost/favicon.ico”, host: “node.say-demo.com”, referrer: "http://node.say-demo.com/"
2016/10/16 14:03:29 [error] 4814#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:3000/”, host: "node.say-demo.com"
2016/10/16 14:03:31 [error] 4814#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://[::1]:3000/”, host: "node.say-demo.com"
2016/10/16 14:03:31 [error] 4814#0: *2 no live upstreams while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://localhost/”, host: "node.say-demo.com"
2016/10/16 14:03:32 [error] 4814#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://[::1]:3000/”, host: "node.say-demo.com"
2016/10/16 14:03:32 [error] 4814#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:3000/”, host: "node.say-demo.com"
2016/10/16 14:03:34 [error] 4814#0: *2 no live upstreams while connecting to upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://localhost/”, host: "node.say-demo.com"
2016/10/16 14:05:27 [error] 4861#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://10.3.68.203:3000/”, host: "node.say-demo.com"
2016/10/16 14:05:28 [error] 4861#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://10.3.68.203:3000/”, host: "node.say-demo.com"
2016/10/16 14:05:33 [error] 4861#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://10.3.68.203:3000/”, host: "node.say-demo.com"
2016/10/16 14:05:34 [error] 4861#0: *2 upstream sent too big header while reading response header from upstream, client: 58.10.50.193, server: node.say-demo.com, request: “GET / HTTP/1.1”, upstream: “http://10.3.68.203:3000/”, host: “node.say-demo.com


#4

Thanks a lot
i got upset. :slight_smile:


#5

Thanks for the details. Here’s your solution…

Just need to increase the buffer size for the headers in your nginx config.