Skip to content
  • 0 Votes
    3 Posts
    3k Views
    Andreas KnightA

    Yes I've tried it.

    Getting an Error. After hours of Google - I have no Idea to fix it:

    nginx: [emerg] "server" directive is not allowed here in /var/www/vhosts/system/ebikeforums.eu/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed
  • Nginx 1.8.0

    NodeBB Development
    2
    0 Votes
    2 Posts
    2k Views
    julianJ

    Heh, and I'm running 1.4 on my local env 😄

    I thought hash load balancing has been in nginx for awhile... hm

  • 0 Votes
    1 Posts
    3k Views
    hekH

    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; } }
  • 0 Votes
    8 Posts
    5k Views
    PakornP

    @aixnr Thanks u 🙂
    It works now

  • 0 Votes
    2 Posts
    2k Views
    L

    Well.. For the nodebb application himself you could use "forever" .... but when it turned 5x i stopped using forever (@julian posted somewhere that nodebb application can do the forever job himself)

    for the database.. well.. dont monitor it YET cz the volume of my transactions is low...

    But any service monitor application could do it.. like nagios ...or newrelic

  • 1 Votes
    5 Posts
    4k Views
    L

    What he says.
    Use both!

  • 2 Votes
    5 Posts
    8k Views
    wzrdtalesW

    Finally the pull request is open https://github.com/NodeBB/NodeBB/pull/2527.

    I'm out for today guys, hope you get everything. If not just ask, gn8.

  • NGINX Error

    General Discussion
    21
    0 Votes
    21 Posts
    13k Views
    G

    @lenovouser Your method works fine for me over https. Thanks for your persistence.

    edit: I just had to add in these two lines for socket.io to work.
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

  • 0 Votes
    8 Posts
    9k Views
    T

    @fr3em1nd said:

    @a_5mith yep

    fuser -k 3000/tcp

    seem to fix it so it will kill all to processes using that port

    It may do work. But it is not very clean and can lead to serious problems to solve problems of this kind that way.
    Just a little advice. No offence. 😉

  • 0 Votes
    6 Posts
    4k Views
    J

    @jimmerz213 said:
    <stuff>

    So I just built a quick VM locally and followed the guides I mentioned above. Did nothing differently except I didn't install php and apache before and start ripping things out. It works flawlessly. I can only imagine at this point its something with my server and I think I may just wipe it and start clean, using nginx only instead of apache.

    Thanks for looking at this stuff guys - I appreciate it.

    Edit - welp, it works great now. Probably has this whole time. The URL I was using to hit the forums was set to be x.x.132.x, it had to be x.x.135.x. Hey, at least I learned a TON about nodebb and nginx 🙂 I'll take it.

  • 0 Votes
    8 Posts
    4k Views
    P

    @a_5mith I have it setup on a new DO droplet using the server IP (no domain yet) for both server_name and the base_url - basically replacing localhost referenced in my previous post. Hope that makes sense.

    for example:
    "base_url": "http://xxx.xxx.xxx.xxx",
    server_name xxx.xxx.xxx.xxx;

    working url via http://xxx.xxx.xxx.xxx:4567/forum
    404 not found for http://xxx.xxx.xxx.xxx/forum

    Appreciate all you help.

  • 0 Votes
    2 Posts
    4k Views
    mootzvilleM

    I figured this out finally...I had nginx v1.2 which is what's in the default debian 7 repo. Had to add a new key and some new sources from here:

    Link Preview Image nginx: Linux packages

    favicon

    (nginx.org)

    Now on nginx v1.6.2 and it seems to be running fine. From what I read there was no websocket support in nginx <1.3

  • 0 Votes
    5 Posts
    50k Views
    P

    @jmj I found that this thread was deleted, I've restored it because I think it will be useful to someone in the future. Hope that's OK with you - and I'm glad you figured it out 🙂

  • 0 Votes
    7 Posts
    4k Views
    A

    @markkus Sounds good to me. 👍 Hopefully this also solves @helltux's issue too.

    Assuming he correctly substitutes his IP in proxy_pass and his domain name in base_url. 😆

  • odd nginx behavior

    General Discussion
    6
    0 Votes
    6 Posts
    2k Views
    L

    @psychobunny yep.. i did the git pull / upgrade stuff before leaving the office... and before creating this thread : /

  • 0 Votes
    1 Posts
    596 Views
    No one has replied
  • 0 Votes
    25 Posts
    47k Views
    julianJ

    @EpicIM_Inc Can you run ifconfig on your server? Is the loopback adapter not set up? 😕

  • 0 Votes
    23 Posts
    18k Views
    meetdilipM

    hi @Matt-Worthington . Nice to see you here. 🙂