Nodebb + nginx + varnish problem



  • I'm trying to run my first nodebb forum but seem it has some issue with websocket when running with nginx & varnish.

    http://forum.tuccauonline.com/socket.io/socket.io.js net::ERR_EMPTY_RESPONSE

    Im using Centos 6.5 64bit and node v0.10.28, nodebb v4.0.1, nginx 1.6.0

    The following is my config.json:

    {
    "base_url": "http://forum.tuccauonline.com",
    "port": "2000",
    "use_port": true,
    "secret": "xxxxxxxx-7c61-f",
    "bind_address": "8.8.8.8",
    "database": "mongo",
    "mongo": {
    "host": "8.8.8.8",
    "port": "8888",
    "username": "username",
    "password": "password",
    "database": "database"
    },
    "bcrypt_rounds": 12,
    "upload_path": "/public/uploads",
    "relative_path": ""
    }

    And two other config file for nginx, varnish
    http://dolphy.nixtoforge.com/varnish_default.txt
    http://dolphy.nixtoforge.com/nginx_conf.txt

    Anyone had face this issue? Please help


  • Admin

    Hi @dolphy -- can you try changing the nginx conf to listen to port 80 instead of 8080? Also change use_port in your config.json to false.

    Maybe that will help...



  • @julian -- Hi Julian, I did, if nodebb running only with nginx then that problem gone, but anothe issue come up, which is relevant to https://github.com/designcreateplay/NodeBB/issues/1540. So its fine. Now I know that Varnish cause this, anyway to figure out why Varnish causing this problem?


  • Admin

    Not entirely sure... better loop @planner in on this one, as he uses varnish on his instance...



  • My knowledge of Varnish is very limited - but don't you have to either pipe Varnish into nginx and then NodeBB or nginx into Varnish and then NodeBB? From your configuration, it seems you're trying to pipe nginx into NodeBB on port 2000 and the same for Varnish. Can Varnish and nginx coexist on the same port?

    Here is my working configuration but against, I'm running nginx to Varnish's default port (e.g., 6081).

    server {
        listen 80;
    
        server_name domain.com *.domain.com;
    
        location / {
            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_pass http://127.0.0.1:6081/;
            #proxy_pass http://127.0.0.1:4567/;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    For Varnish, I'm just using the default instructions. RHEL 6.5 as well.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.