Assistance Configuring Nginx on Ubuntu 14.04 with NodeBB



  • Hey guys! I'm having a couple issues and I'm sure it's something rather simple. I'm not usually one to ask for help unless I'm just completely lost, so here I am!

    I'm having an issue setting up a proxy on my nginx server. All I'm looking to do is load NodeBB from 127.0.0.1:4567 for my domain. It's working fine with the trailing port (forgeunity.com:4567), but obviously I want it to load on port 80.

    Forgeunity.com will load the default nginx page (until I deleted the default configuration, oops!), but I can't seem to get it to load my NodeBB installation. My current attempt is pretty much just from the NodeBB nginx guide, but here's everything I have:

    Here's my nginx configuration, forgeunity:

    server {
        listen 80;
    
        server_name forgeunity.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:4567/;
            proxy_redirect off;
    
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    My NodeBB config.json

    {
        "url": "http://forgeunity.com",
        "secret": "SECRET",
        "database": "redis",
        "redis": {
            "host": "127.0.0.1",
            "port": "6379",
            "password": "",
            "database": "0"
    }
    

    }

    For further information about my server, here's what I did:

    1. Spun up a Ubuntu 14.04 Node image (which is just preinstalled Node v4.2.1)
    2. Used NVM to install Node v0.10.40
    3. Installed and configured NodeBB to work directly on my server via its port
    4. Setup my domain name on my domain registrar side as well as DigitalOcean's side
    5. Installed nginx and "configured" it to not work properly, obviously
    6. Came here for assistance after hours of failure 😣

    Thanks in advance, everyone!



  • I have a very similar setup, except that I am using numerous instances of nodebb within an upstream block, which I would suggest on your droplet depending on it's size:

    upstream forum_nodes {
        ip_hash;
        server 127.0.0.1:4567;
        server 127.0.0.1:4568;
        server 127.0.0.1:4569;
        server 127.0.0.1:4570;
    }
    
    server {
        listen 80;
    
        server_name forum.somedomain.tld;
    
        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;
    
        # 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://forum_nodes;
        }
    
        location ~ ^/(images|language|sounds|templates|uploads|vendor|src\/modules|nodebb\.min\.js|stylesheet\.css|admin\.css) {
            root /home/nodebb/nodebb/public/;
            try_files $uri $uri/ @nodebb;
        }
    
        location / {
            proxy_pass http://forum_nodes;
        }
    }
    


  • Check the docs for a list of steps:
    https://docs.nodebb.org/en/latest/configuring/proxies/nginx.html

    Also change location / to location ~^/


Log in to reply
 

Suggested Topics

| |