Install and Setup NodeBB with Redis and Nginx on Ubuntu 12.04

In the following post we will show you how to install and configure NodeBB on an Ubuntu VPS. NodeBB is a modern and open-source Forum Software powered by Node.js . It is a powerful discussion platform offering one-click plugin install, social network connectivity and responsive design.


Login to your server using SSH

ssh username@hostname

Update the system and install all the necessary packages.

~ # ❯❯❯ sudo apt-get -y update && apt-get -y upgrade
~ # ❯❯❯ sudo apt-get -y install python-software-properties git sed supervisor

Install the latest version of Nodejs

~ # ❯❯❯ sudo add-apt-repository ppa:chris-lea/node.js
~ # ❯❯❯ sudo apt-get update && sudo apt-get install nodejs

Install the the latest version of Redis

~ # ❯❯❯ sudo add-apt-repository -y ppa:rwky/redis
~ # ❯❯❯ sudo apt-get update && sudo apt-get install -y redis-server

Pull down the latest NodeBB code

~ # ❯❯❯ mkdir ~/myNodebbApp && cd $_
~ # ❯❯❯ git clone https://github.com/designcreateplay/NodeBB.git . # do not forget the dot at the end

Configure NodeBB

Install all NodeBB’s dependencies

 # ❯❯❯ npm install

Type the following, while in the NodeBB root directory:

~ # ❯❯❯ node app --setup='{ 
    "base_url": "http://yourAppUrl.com",
    "admin:username": "adminUsername", 
    "admin:password": "adminPassword", 
    "admin:password:confirm": "adminPassword",
    "admin:email": "your@email.com"

Using Nginx as a proxy for NodeBB

Install and Configure the the latest version of Nginx

~ # ❯❯❯ sudo add-apt-repository -y ppa:nginx/stable
~ # ❯❯❯ sudo apt-get update
~ # ❯❯❯ sudo apt-get install -y nginx

Set the worker_processes to the number of processors in your system. To find out the number of processors in your system and set the worker_processes, run the following command:

~ # ❯❯❯ sudo sed -i "0,/^worker_processes/ s/^worker_processes .*$/worker_processes `grep -c processor /proc/cpuinfo`;/"  /etc/nginx/nginx.conf

Create a new nginx virtual host

~ # ❯❯❯ sudo vim /etc/nginx/sites-available/yourAppUrl.com
server {
    listen       80;
    server_name  yourAppUrl.com;
    location / {
        proxy_pass        http://localhost:4567/;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_redirect off;
        proxy_buffering   off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
~ # ❯❯❯ sudo ln -s /etc/nginx/sites-available/yourAppUrl.com /etc/nginx/sites-enabled/yourAppUrl.com
~ # ❯❯❯ sudo /etc/init.d/nginx restart

That’s it. Now open your browser and navigate to your domain.

For more info about NodeBB please go to: https://nodebb.org

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials

View Comments

Leave a Comment