Add NGINX as NodeBB Proxy Server

Since you already have a domain name and server (droplet) ip point domain or subdomain to the IP address with A record. It will take a few minutes to a few hour to work. In the meantime we will configure Nginx.

In the previous page of the tutorial we have already NGINX and running. It should be running on port 80. Simply visit:


to see NGINX welcome page.

We also have running our forum on IP Address + Port 4567. Here we will only configure Nginx to serve as proxy server.

NGINX Configuration for NodeBB

To configure Nginx, first we will copy the default configuration file to a file name (or as per your domain). Simply replace all with your real sub/domain where you want to your NodeBB forum.

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/

now edit the file. Run

sudo nano /etc/nginx/sites-available/

the default server block in the configuration file will be like this:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

Modify it to something like this:

server {
        listen 80;
        #listen [::]:80 ipv6only=on;

        root /var/www/nodebb/forums;
        index index.html index.htm;

        # Make site accessible from http://localhost/

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                # try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

		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";


Change you might notice:

  • removed listen default_server
  • commented out next line, it was for IPv6
  • root changed to /var/www/nodebb/forums
  • server_name changed to
  • commented out try_files declaratives
  • And added many lines in the location

Now we will create a symlink using following commands:

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Now reload Nginx Config file with the help of following commands:

sudo service nginx reload

Configure NodeBB for Nginx

Once the Nginx is configured properly we have to make a few changes in NodeBB configuration file. To do so run

nano /var/www/nodebb/forums/config.json

and make a few changes:

    "url": "",
    "secret": "285530bc-ddc0-45d6-ae31-ea7cec4b9eb7",
    "database": "redis",
    "redis": {
        "host": "",
        "port": "6379",
        "password": "",
        "database": "0"


    "url": "",
    "secret": "2cdaec-x0xx-45d6-ae31-eaasccxxeb7",
    "bindaddress": "localhost",
    "port": "4567",
    "database": "redis",
    "redis": {
        "host": "",
        "port": "6379",
        "password": "",
        "database": "0"

Notice the following lines:

  • "url": "",
  • "bindaddress": "localhost",
  • "port": "4567",
  • <"use_port":false,

Now restart NodeBB with following commands:

cd /var/www/nodebb/forums
./nodebb restart

By now your domain should have propagated. Try to visit your forum by typing forum address.

in my case. What is yours? Join our forums and share yours.

Install NodeBB on DigitalOcean Cloud In 5 minutes

In today’s tutorial we will install NodeBB on DigitalOcean cloud in just 5 minutes. Yeah, It’s different but these days serverside Javascript software are trending. The reason behind is their ability to handle real-time communication with minimal effort and resources. JavaScript is, however, not my expertise but hey we do not need to learn about JavaScript. We will simply install  NodeBB on DigitalOcean with little effort.

How to Install NodeBB on DigitalOcean

There is already some good article written about installing NodeBB on different environments. One of the easiest was from Andrew Rodrigues, co-founder of NodeBB, itself. But that seems to be old and there are many points which should be updated now. I will extend that article more or less. Feel free to inform me if anything needs attention.

*Disclaimer: That’s a referral link. But if you sign up DigitalOcean using my link then you will also get $10 credit. This credit will be enough for 2 months hosting.

Let’s install NodeBB in 5 Minutes

NodeBB, a forum software for instant interaction and real-time notifications, runs on server-side JavaScript program called NodeJS. The beauty of NodeJS is to handle thousands of concurrent users with a single process. It is incredibly fast but might be totally new for WordPress users.

Let’s install NodeBB on tiniest DigitalOcean server with 512Mb RAM. Even this droplet (the server) will be good to start. You can scale it anytime or as required.

Create Server and Initial Server Setup

Sign up DigitalOcean and create your first server. Here they call it a droplet. The droplet creation is pretty easy and the creation window look similar to the image below. Select

  1. Operating System – Ubuntu 14.04 (or later)
  2. Droplet Size – 512 MB (or more if you like. they will highlight 1GB droplet by default)
  3. Host Name – Something easy. Let’s consider alpha

You may leave all other options intact OR change as per your need.


DigitalOcean will send you an email with login credentials upon successful droplet creation. We will need these credentials to login to the droplet via SSH.

Log into Server

To log into your server we need a tiny software called PuTTY. It’s free and can be downloaded from here. (Simply download PuTTY for For Windows on Intel x86. It will work fine on any Windows OS. Linux and Apple users do not need PuTTY.


PuTTY window looks like the screenshot above. Simply enter IP Address (as provided in DigitalOcean email), port 22 and select connection type SSH.

Once you hit open you will be connected and asked for login as. Enter root as your username and then password (the one you received in email).

login as: root
[email protected]'s password:

Once you successfully logged in you will be asked to change password for root. Enter current password and then new password twice. Even if the terminal do not ask to change the password, you may change it by entering following command for logged in user:


Create a user with sudo privilege:

Now, run the following commands to add a user of your choice. I have used bill for this tutorial. (Do not copy the # or $ sign from any of the following commands. Also do not change directory unless your are told to do so or you are sure about it.

adduser bill

You will be asked to enter a few details about username bill. Except password leave other options blank and hit enter. Once the user is created run the following command to give it superuser privilege.

adduser bill sudo

Now, logout with the command logout.

Install Dependencies and Prerequisites for NodeBB

Open a fresh PuTTY terminal and login with the user id bill (or yours, if you have created something else) and run the following command:

sudo apt-get update

It will update the packages but take a few seconds to complete. After completion run the following command various software and dependencies including git, nodejs, npm, redis-server and nginx.

sudo apt-get install git nodejs npm redis-server nginx build-essential imagemagick

It will take about a minute to install. Since Ubuntu has another package called node, we have to create symbolic link for nodejs. run the following command:

sudo ln -s `which nodejs` /usr/local/bin/node

Notice the backticks in the above command. It’s not single colon.

Install NodeBB on DigitalOcean

Now we have completed installing all the dependencies for NodeBB. So it’s time to install NodeBB but first create a directory for it. In the tutorial we will install our forum in a dedicated directory called forums. You may change it to what so ever to identify easily.

sudo mkdir -p /var/www/nodebb/forums

And Then

cd /var/www

Now, the prompt will be like this: [email protected]:/var/www$. It’s time to change the ownership of the directory to bill.

sudo chown -R bill:bill nodebb

If you have some other user name created change it accordingly. Now run

cd nodebb

It’s time clone NodeBB to the forums directory with following command

git clone git:// forums

Now move to the directory forums and install NodeBB. To do so run the following commands one by one:

cd forums
npm install

In the following command you will be asked for NodeBB configuration. Here we will only have to configure ip address and rest should be left blank. The IP address is same as your server ip, configure accordingly. The setup is like this. Later you will be asked for a Admin account, enter your desired login id and password to log into forum. Run

node app --setup

Once the setup is complete, run the following command to start the forum:

node app

At this level you might encounter similar error:

 15/12 01:50 [12503] - error: Your Redis version is not new enough to support NodeBB, please upgrade Redis to v2.8.9 or higher.
 [cluster] Child Process (12503) has exited (code: 0, signal: null)

To fix the above issue we have to upgrade redis to a later version. Add chris-lea/redis-server repository with following command. The repository is recommended by NodeBB itself.

sudo apt-add-repository ppa:chris-lea/redis-server

Now update repositories:

sudo apt-get update

and then install updated version of redis with the help of following command:

sudo apt-get install redis-server

Again run

node app

This time everything should be fine and we have successfully installed NodeBB on DigitalOcean. Your forum will be available on http://<droplet-ip=address>:4567

As you have seen it it really easy to install NodeBB on DigitalOcean droplet we will configure Nginx to act as NodeBB Proxy in the next post. If you face any issue leave a comment below or want to take a preview of a NodeBB forum on 512MB DigitalOcean droplet head to our forums. It’s pretty new and I would appreciate to leave a comment or join our forums.

In the Series:

  • How to Install NodeBB on DigitalOcean Cloud In 5 minutes ← You are here
  • Add NGINX Proxy to add your domain name. (Required)
  • Disable root login (Highly Recommended)
  • Change SSH Port (Highly Recommended)
  • Add firewall (Highly Recommended)