I must have misconfigured something. But I cannot find out what the problem is. Is anone else experiencing lots of "upstream prematurely closed connection while reading response header from upstream" errors in their nginx log?
Tried tweaking buffers sizes etc but I see no difference. Get the feeling that nodebb is terminating polling clients connections.
Running 0.7.0-dev
bash-4.3# tail -f error.log
2015/04/16 11:08:22 [error] 3682#0: *2132594 upstream prematurely closed connection while reading response header from upstream, client: 80.215.161.163, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291349-3624&sid=RfZHfKKEwNVHpVXoAwaK HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291349-3624&sid=RfZHfKKEwNVHpVXoAwaK", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/1251/power-emission-of-nrf/3"
2015/04/16 11:08:22 [error] 3682#0: *2134758 upstream prematurely closed connection while reading response header from upstream, client: 193.0.242.40, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291692-46449&sid=viXvQ0qO3-W84q8WAwaR HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291692-46449&sid=viXvQ0qO3-W84q8WAwaR", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/category/1/your-project"
2015/04/16 11:08:22 [error] 3683#0: *2134660 upstream prematurely closed connection while reading response header from upstream, client: 193.0.242.40, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291694-5713&sid=prgDiad8lLBmOgMSAwaS HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291694-5713&sid=prgDiad8lLBmOgMSAwaS", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/1018/contest-3d-printed-battery-powered-wall-remote-control"
2015/04/16 11:08:22 [error] 3683#0: *2134796 upstream prematurely closed connection while reading response header from upstream, client: 193.0.242.40, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291697-5940&sid=8YnoBBC_BNP6ebocAwaT HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291697-5940&sid=8YnoBBC_BNP6ebocAwaT", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/796/mysensors-contest-2015/9"
2015/04/16 11:08:22 [error] 3683#0: *2135121 upstream prematurely closed connection while reading response header from upstream, client: 193.109.225.252, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175292021-2931&sid=O8ibWd4vz1Xwl23sAwZ_ HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175292021-2931&sid=O8ibWd4vz1Xwl23sAwZ_", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/305/mysensors-protocol-format"
2015/04/16 11:08:22 [error] 3683#0: *2136215 upstream prematurely closed connection while reading response header from upstream, client: 193.0.242.40, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291704-46206&sid=MqxqCEmwFpQygRUJAwaQ HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291704-46206&sid=MqxqCEmwFpQygRUJAwaQ", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/404/3-in-1-humidity-temp-and-motion/18"
2015/04/16 11:08:22 [error] 3682#0: *2133315 upstream prematurely closed connection while reading response header from upstream, client: 193.109.225.252, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175292024-2940&sid=iBD3mJ_QApuEKMexAwaA HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175292024-2940&sid=iBD3mJ_QApuEKMexAwaA", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/175/open-source-home-automation-raspberry/2"
2015/04/16 11:08:22 [error] 3682#0: *2135389 upstream prematurely closed connection while reading response header from upstream, client: 193.109.225.252, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175292028-2896&sid=FGds-qrKOaArQkHwAwaB HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175292028-2896&sid=FGds-qrKOaArQkHwAwaB", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/175/open-source-home-automation-raspberry"
2015/04/16 11:08:22 [error] 3682#0: *2136281 upstream prematurely closed connection while reading response header from upstream, client: 193.0.242.40, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291713-46237&sid=qdnYQxCy4rSXwKIiAwaU HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291713-46237&sid=qdnYQxCy4rSXwKIiAwaU", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/486/my-2aa-battery-sensor"
2015/04/16 11:08:22 [error] 3682#0: *2136491 upstream prematurely closed connection while reading response header from upstream, client: 94.153.230.50, server: forum.mysensors.org, request: "GET /socket.io/?EIO=3&transport=polling&t=1429175291870-45599&sid=jlQkVDgDcwlbk1yBAwaV HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=3&transport=polling&t=1429175291870-45599&sid=jlQkVDgDcwlbk1yBAwaV", host: "forum.mysensors.org", referrer: "http://forum.mysensors.org/topic/303/mqtt-broker-gateway/5"
config.json
config.json
{
"secret": "xxx",
"bind_address": "127.0.0.1",
"database": "redis",
"redis": {
"host": "127.0.0.1",
"port": "6379",
"password": "xxx",
"database": "1"
},
"url": "http://forum.mysensors.org"
}
/etc/nginx/nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
proxy_buffers 8 16k;
proxy_buffer_size 32k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-enabled/default
server {
listen 80;
server_name forum.mysensors.org;
# prevents 502 bad gateway error
large_client_header_buffers 8 32k;
client_max_body_size 2M;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_buffering off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
gzip on;
gzip_min_length 1000;
gzip_proxied off;
gzip_types text/plain application/xml application/x-javascript text/css application/json;
location @nodebb {
proxy_pass http://127.0.0.1:4567;
}
location ~ ^/(images|language|sounds|templates|uploads|vendor|src\/modules|nodebb\.min\.js|stylesheet\.css|admin\.css) {
root /usr/mysensors/mysensors-forum/NodeBB/public/;
try_files $uri $uri/ @nodebb;
}
location / {
error_page 502 =200 @maintenance;
# prevents 502 bad gateway error
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_pass http://127.0.0.1:4567;
}
location @maintenance {
root /opt/nginx/maintanance/;
try_files $uri /index.html =503;
}
}