NginX configuration assistance with NodeBB, Redis and Ubuntu 12.04.5 32bit on Digital Ocean droplet



  • After following the many imperfect tutorials online, Our forum is up and running, but only on port:4567.
    NginX has been installed, and configured (although not properly)
    Now when navigating to http://sitedomain.com we are welcomed by the NginX "default" html, and not our forum.

    Some information that might be helpful:
    Location of forum : /var/www/sitedomain
    No special permissions have been applied to the folder.

    Nodebb configuration

    When node app --setup asks for a url, the Virtual droplets IP address was inserted
    everything else was set as default.

    The current overall configuration has two issues.
    The first issue is that the sites-available/sitedomain (which is linked to the sites-enabled/sitedomain) is not configured at all (removed all previous configuration as nothing has worked yet) I have tried every configuration online, including the virtual server configuration notated in the "default" file.
    The second issue is that something by default is still pointing NginX to load the Default file rather than the file, sitedomain.
    Attempting to bypass the latter issue, I replaced the root path in the default configuration with the root path /var/www/sitedomain.
    This result is NginX providing a 403 Forbidden error when navigating to http://sitedomain.com.
    Unsure of what I am doing in the sites-available configuration, I am going off the knowledge of the many flawed tutorials, that I also need an "index" line pointing to the file that is actually loading the forum. Unfortuately, I have tried multiple files, with multiple attributes, most of which result in the downloading of ,for example, the nodebb.bat file straight to my computer, which makes me believe that it is not a permissions issue.

    If anybody could provide me with what they believe is the best <sitedomain> configuratin (located in sites-available) based on what I have described, along with where I need to configure nginx to look to my sitedomain file, rather than default, I would be very greatful.
    After following the many imperfect tutorials online, Our forum is up and running, but only on port:4567.
    NginX has been installed, and configured (although not properly)
    Now when navigating to http://sitedomain.com we are welcomed by the NginX "default" html, and not our forum.

    Some information that might be helpful:
    Location of forum : /var/www/sitedomain
    No special permissions have been applied to the folder.

    Nodebb configuration

    When node app --setup asks for a url, the Virtual droplets IP address was inserted
    everything else was set as default.

    The current overall configuration has two issues.
    The first issue is that the sites-available/sitedomain (which is linked to the sites-enabled/sitedomain) is likely not configured properly as I have tried every configuration online, including the virtual server configuration notated in the "default" file.
    The second issue is that something by default is still pointing NginX to load the Default file rather than the file, sitedomain.
    Attempting to bypass the latter issue, I replaced the root path in the default configuration with the root path /var/www/sitedomain.
    This result is NginX providing a 403 Forbidden error when navigating to http://sitedomain.com.
    Unsure of what I am doing in the sites-available configuration, I am going off the knowledge of the many flawed tutorials, that I also need an "index" line pointing to the file that is actually loading the forum. Unfortuately, I have tried multiple files, with multiple attributes, most of which result in the downloading of ,for example, the nodebb.bat file straight to my computer, which makes me believe that it is not a permissions issue.

    Some configuraions I have tried using before:

    https://docs.nodebb.org/en/latest/configuring/proxies/nginx.html

    http://websetnet.com/install-and-setup-nodebb-with-redis-and-nginx-on-ubuntu-12-04/

    If anybody could provide me with what they believe is the best sitedomain configuratin (located in sites-available) based on what I have described, along with where I need to configure nginx to look to my sitedomain file, rather than default, my team would be very appreciative.



  • Do this:

    • Make sure the fully qualified domain name you are going to use for your forums resolves fine.
    • Set that domain name as a server on your nginx.conf, and create a dummy page.
    • Make sure you can browse to the domain name, and see the dummy page.
    • Make sure Redis is running.
    • Run the nodebb setup and use the fully qualified domain name, not the IP.
    • Check nodebb is running fine by going to the fully qualified domain name, port 4567.
    • Modify nginx.conf accordingly, following documentation.


  • @Fastidious said:

    Check nodebb is running fine by going to the fully qualified domain name, port 4567.

    Configuration
    NGINX-served sites are contained in a server block. This block of options goes in a specific place based on how nginx was installed and configured:

    /path/to/nginx/sites-available/* – files here must be aliased to ../sites-enabled
    /path/to/nginx/conf.d/*.conf – filenames must end in .conf
    /path/to/nginx/httpd.conf – if all else fails
    Below is the basic nginx configuration for a NodeBB build running on port 4567:

    What is the *.conf; the nginx config file listed just below that?



  • The three options in the docs were not clear as options rather than mandatory. Nginx.conf moved from the first option to the second option and it then worked.


  • Admin

    @lulzdevlol It is your choice whether to use the conf.d/ folder or the sites_enabled/ folder.

    Both work fine so if conf.d/ works for you, then great!



  • I know that this topic is already a bit old, but here the direct fix for people encountering the same problems:

    Edit /etc/nginx/nginx.conf and add these lines within the http section:

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    

    Save and close the file, now create a new file in /etc/nginx/sites-enabled (create the directory if it isn't existent).
    In this sample we will name the file mywebsite.conf:

        server {
        listen 80;
        server_name mywebsite.com www.mywebsite.com;
    	access_log /DIRECTORY/TO/LOG/access.log;
        error_log /DIRECTORY/TO/LOG/error.log;
    	root  /DIRECTORY/TO/public_html;
    
    
    # nodeBB
        location ^~ /forum {
        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://mydomain.com:4567;
        proxy_redirect off;
        }
    
      }
    

    Please note, the rewrite is active for the directory /forum, if your nodeBB installation is in the root directory remove "forum".

    Lastly we will open the config.json from nodeBB:
    {
    "url": "https://mywebsite.com/forum",
    "secret": "blablabla",
    "database": "redis",
    "redis": {
    "host": "127.0.0.1",
    "port": "6379",
    "password": "blablabla",
    "database": "0"
    }
    }

    Please note, the rewrite is active for the directory /forum, if your nodeBB installation is in the root directory remove "forum".



  • Hey thx for the update. its never too late. 🙂



  • @lulzdevlol said:

    Hey thx for the update. its never too late. 🙂

    Before I forget you must restart NGINX and nodeBB so the changes take place, but I hope it is clear to you.

    Lastly it would be interesting to know, if you were able to resolve the issue.


Log in to reply
 


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