Skip to content

Installing on Windows

This installation guide is optimized for Windows 10 and will install NodeBB with MongoDB as the database. Fully patched LTS and equivalent production versions of software are assumed and used throughout.

Confused? – A simpler guide for Ubuntu 18.04 with lots of screenshots can be found on the NodeBB Blog.

System Requirements

  • Memory: Installing NodeBB's dependencies may require more than 512 megabytes of system memory. It is recommended to enable a swap partition to compensate if your Linux system has insufficient memory.

Installing Node.js

Naturally, NodeBB is driven by Node.js, and so it needs to be installed. Node.js is a rapidly evolving platform and so installation of the current LTS version of Node.js is recommended to make future updates seemless. The Node.js LTS Plan details the LTS release schedule including projected end-of-life.

  1. Download Node.js lts
  2. Execute the installer

Verify installation of Node.js and npm. You should have version lts of Node.js installed, and version 8 of npm installed:

node -v
npm -v (should output "8.11.0" or similar)


Installing MongoDB

MongoDB is the default database for NodeBB. As noted in the MongoDB Support Policy versions older than 4.0 are officially End of Life as of October 2021. This guide assumes installation of 5.0. If you wish to use another database instead of MongoDB the Configuring Databases section has more information.

Official detailed installation instructions can be found in the MongoDB manual. Although out of scope for this guide, some MongoDB production deployments leverage clustering, sharding and replication for high availibility and performance reasons. Please refer to the MongoDB Replication and Sharding topics for further reading. Keep in mind that NodeBB does not require any of these advanced configurations, and doing so may complicate your installation. Keeping it simple often can be best.

The following is an abbreviation of the official MongoDB installation guide for Windows.

Go to the MongoDB Download Center and download the appropriate setup file

Locate the downloaded .msi file and execute it to start the installer

The default installation location is C:\Program Files\MongoDB\Server\5.0

Add the MongoDB binaries to your PATH

  1. Find the bin directory under your MongoDB installation The default path is C:\Program Files\MongoDB\Server\5.0\bin
  2. Type PATH into the Start Menu search bar
  3. Open Edit environment variables for your account
  4. Under User variable for [your username], click on Path
  5. Click the Edit... button
  6. Click the New button on the right
  7. Type or paste in the full path to the bin directory

Configure a service for the mongod server

  1. Open an administrator command prompt

  2. Create two directories for your database and log files. We'll use C:\MongoDB\data\db and C:\MongoDB\logs

  3. Create a config file (C:\MongoDB\mongod.cfg) defining those paths

        destination: file
        path: C:\MongoDB\logs\mongod.log
        dbPath: C:\MongoDB\data\db

  4. Install the MongoDB service

    mongod.exe --config "C:\MongoDB\mongod.cfg" --install

Verify installation of MongoDB. You should have version 5.0:

mongod --version
db version v5.0

Start the mongod service and verify service status:

net start MongoDB
sc query "MongoDB" | findstr STATE

Configure MongoDB

General MongoDB administration is done through the MongoDB Shell mongo. A default installation of MongoDB listens on port 27017 and is accessible locally. Access the shell:


Switch to the built-in admin database:

> use admin

Create an administrative user (the is different from the nodebb user we'll create later). Replace the placeholder <Enter a secure password> with your own selected password. Be sure that the < and > are also not left behind.

> db.createUser( { user: "admin", pwd: "<Enter a secure password>", roles: [ { role: "root", db: "admin" } ] } )

This user is scoped to the admin database to manage MongoDB once authorization has been enabled.

To initially create a database that doesn't exist simply use it. Add a new database called nodebb:

> use nodebb

The database will be created and context switched to nodebb. Next create the nodebb user with the appropriate privileges:

> db.createUser( { user: "nodebb", pwd: "<Enter a secure password>", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )

The readWrite permission allows NodeBB to store and retrieve data from the nodebb database. The clusterMonitor permission provides NodeBB read-only access to query database server statistics which are then exposed in the NodeBB Administrative Control Panel (ACP).

Exit the Mongo Shell:

> quit()

Enable database authorization in the MongoDB configuration file C:\MongoDB\mongod.cfg by appending the following lines:

  authorization: enabled

Restart MongoDB and verify the administrative user created earlier can connect:

net stop MongoDB
net start MongoDB
mongo -u admin -p your_password --authenticationDatabase=admin

If everything is configured correctly the Mongo Shell will connect. Exit the shell.

Installing NodeBB

First, we must install git as it is used to distribute NodeBB:

  1. Download Git for Windows here
  2. Execute that setup file to install Git
  3. During setup, select the Use Git from the Windows Command Prompt option, which will correctly configure your PATH environment to use git

Note: commands like git and ./nodebb should not be used with root access (sudo or elevated privileges). It will cause problems with different ownership of files NodeBB needs access to

Next, clone NodeBB into an appropriate location. Here the local nodebb directory is used, though any destination is fine:

git clone -b v2.x nodebb
cd nodebb

This clones the NodeBB repository from the v2.x branch to the nodebb directory. A list of alternative branches are available in the NodeBB Branches GitHub page, but only the versioned branches are stable.

NodeBB ships with a command line utility which allows for several functions. We'll first use it to setup NodeBB. This will install modules from npm and then enter the setup utilty.

nodebb setup

A series of questions will be prompted with defaults in parentheses. The default settings are for a local server listening on the default port 4567 with a MongoDB instance listening on port 27017. When prompted for the mongodb username and password, enter nodebb, and the password that you configured earlier. Once connectivity to the database is confirmed the setup will prompt that initial user setup is running. Since this is a fresh NodeBB install a forum administrator must be configured. Enter the desired administrator information. This will culminate in a NodeBB Setup Completed message.

Note: When entering your site URL, make sure it is exactly what you plan on accessing your site at. If you plan on visiting to open your forum, then enter exactly

A configuration file config.json will be created in the root of the nodebb directory. This file can be modified should you need to make changes such as changing the database location or credentials used to access the database.

Finally, you can use the cli utility to start NodeBB:

nodebb start

Installing nginx

NodeBB by default runs on port 4567, meaning that by default you must access it using a port number in addition to the hostname (e.g.

In order to allow NodeBB to be served without a port, nginx can be set up to proxy all requests to a particular hostname (or subdomain) to an upstream NodeBB server running on any port.

The following is an abbreviation of the Windows nginx installation instructions.

  1. Create a new directory C:\nginx
  2. Download the stable nginx win32 binary
  3. Double click to open the .zip file
  4. Double click to open the enclosed nginx-<version> directory
  5. Select all of the enclosed files and directories
  6. Copy them to C:\nginx

Verify the installation of nginx

nginx -v

and that the service will run

cd C:\nginx
start nginx
tasklist | findstr nginx.exe

You should now be able to go to your site's address in your browser and see the default Welcome to nginx! message.

Configuring nginx

NGINX-served sites are contained in a server block which are normally stored in separate files from the main nginx config (which is very rarely edited).

However, when installing with the method above, the server block config is embedded in C:\nginx\conf\nginx.conf.

Below is an example configuration for NodeBB running on port 4567.

server {
    listen 80;


    location / {
        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_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";

After making changes to nginx configs, you have to reload the service for changes to take effect:

cd C:\nginx
nginx -s reload

For more information, go to the configuring nginx page.

After Installation

Great, you have NodeBB installed and running. You should be able to access and interact with your forum.