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:
How To Install nginx on Ubuntu 12.04 LTS (Precise Pangolin) | DigitalOcean
This tutorial explains how to install nginx, how to start nginx, and how to confirm that nginx is running on your server. nginx is a high performance web se…
(www.digitalocean.com)
How to Install NodeBB on Ubuntu 18.04 - RoseHosting
How to Install NodeBB on Ubuntu 18.04 - RoseHosting
RoseHosting (www.rosehosting.com)
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?
-
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".
-
@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.