NodeBB on Windows 10 / 2016

  • Hello All,

    this is a guideline of how to get NodeBB running on Windows in a way which worked for me.
    I will update this guideline over time as there is always something to improve.

    Prerequisites Stuff

    These steps have been captured by a new VPS installation.
    The following was installed before attempting the steps further below:

    • Windows Server 2016 / Windows 10 (tested on both)
    • Full Windows Update
    • Visual Studio Code Insider
    • Visual Studio Community Edition 15.7.1 (C++ and .NET Environments)

    Download Stuff





    Install Stuff

    Install Node.js > X:\Node
    Unzip nginx > X:\nginx
    Unzip NodeBB > X:\NodeBB
    Install Mongo > X:\MongoDB

    Test Stuff

    Test Node.js
    cmd > node --version


    Test nginx
    cmd > X:\nginx
    nginx -v

    nginx version: nginx/1.14.0

    Test Mongo
    Add to Path (User & System) > X:\MongoDB\bin
    cmd > mongod --version

    db version v3.6.4

    Configure Mongo Service Stuff

    mkdir X:\MongoDB\data\db
    mkdir X:\MongoDB\logs

    make a file called mongod.cfg:

     destination: file 
     path: X:\MongoDB\logs\mongod.log
     dbPath: X:\MongoDB\data\db
      authorization: enabled

    copy mongod.cfg > X:\MongoDB\mongod.cfg

    Install Mongo as Windows Service
    sc.exe create MongoDB binPath= ""X:\MongoDB\bin\mongod.exe" --service --config="X:\MongoDB\mongod.cfg"" DisplayName= "MongoDB" start= "auto"

    [SC] CreateService SUCCESS

    net start MongoDB

    The MongoDB service is starting.
    The MongoDB service was started successfully

    How to Remove Mongo as Windows Service
    net stop MongoDB
    sc.exe delete MongoDB

    Create Mongo Database Stuff

    Create 2 very good long safe uncrackable passwords:

    PASSWORD1 > MondoDB Admin
    PASSWORD2 > MongoDB NodeBB Account

    cmd > mongo

    use admin
    db.createUser( { user: "admin", pwd: "PASSWORD1", roles: [ { role: "readWriteAnyDatabase", db: "admin" }, { role: "userAdminAnyDatabase", db: "admin" } ] } )

    Look for something like:

    "Successfully added user"

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

    use nodebb
    db.createUser( { user: "nodebb", pwd: "PASSWORD2", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )

    Look for something like:

    "Successfully added user"


    NodeBB Configuration Stuff

    cmd > X:\NodeBB
    nodebb setup

    Wait for stuff to happen ..
    Answers the prompts
    Note: Set the URL to your real if you want to use one !

    Or fix it later here:

    If you mess up, start again with:
    nodebb setup

    Check for:

    "NodeBB Setup Completed"

    Start the Forum
    cmd > nodebb start

    To Stop ..
    nodebb stop

    Node.js will start up
    Access your forum at your Yourdomain:4567 (or localhost:4567 for testing)

    nginx Stuffnx

    Edit C:\nginx\conf\nginx.conf

    #user  nobody;
    worker_processes  1;
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    #pid        logs/;
    events {
        worker_connections  1024;
    http {
        include       mime.types;
        default_type  application/octet-stream;
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
        #access_log  logs/access.log  main;
        sendfile        on;
        #tcp_nopush     on;
        #keepalive_timeout  0;
        keepalive_timeout  65;
        #gzip  on;
    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";

    make sure to edit ..


    .. with your real webserver external IP

    Default value for the listening IP is:

    server_name $hostname;

    Which gets translated to which means 'All IPs'

    Ok, lets move on ..

    start nginx

    Good to know:
    nginx -s stop
    nginx -s restart

    Access your forum at: Yourdomain:80

    You want to further tune your nginx.conf by doing lots of Google research but it should work for now.

    More Stuff

    1. Get extreme speeds by putting your X:\ in a Ramdisk

    I recommend Softperfect Ramdisk as unlike other Windows ramdisks it has excellent performance on parallel read/write requests.
    Currently I have Node.js/Mongo/nginx/NodeBB on a Ramdisk image with a size of 4GB, autosave every 60 minutes or any interval you need. Around 2.5GB are used for all having an empty forum.

    1. Issues: I still investigate a problem with Mongo to cash overnight, will update once I figure that out.

    2. Tuning: You do not really need to use nginx in this scenario. It all depends on your own website project. However nginx can offer some cache features and other magic things which you may want to use at some point.

    3. Windows Firewall, if you can't connect to the forum from an external device, try to edit your Windows Firewall configuration for Port 80 to listen to your external IP only. If you set it to "All IP's" it did not work for me somehow.

  • This post is deleted!
  • @pummelchen said in NodeBB on Windows 10 / 2016:

    Issues: I still investigate a problem with Mongo to cash overnight, will update once I figure that out.

    So turned out that when the forum has no traffic, like when it sits idle overnight, something gets a timeout and the forum responds with "Internal Server Error" once you load it in the morning. Need to run nodebb stop/start cycle to fix that.

    Since I have a website alive monitor running which loads the forum every x seconds from external also to measure response time for performance monitoring, that issue is gone.

    Forum is responsive and stable for many days now without a single failure. Total RAM usuage for mongo/node/ngix is around 360 MB while the website monitor sends one request every 10 seconds to the forum over Cloudfare and the same to the homepage which simulates ca. 20.000 users per month in total.

  • I have this error message when trying to start mongob.exe

    Any idea of how to solve the problem of cache and meroria?

    WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor performance.

  • That's a warning, not an error.

  • I guess you use a VPS with low RAM, and Windows needs to swap out to keep going. My VPS has 8GB RAM and 2GB swap with usually 5-6GB RAM free even under stress test.

  • If anyone gets this error having the forum in a subfolder like

    forumcategories Not Found

    Fix Here

  • T Topper referenced this topic on

Suggested Topics

  • 1 Votes
    14 Posts

    Yeah @kurulumu-Net you can change port in config.json in one of the NodeBBs and change to the same port in the proxy-pass part of the corresponding nginx config.

    Default port is 4567, one will need to be changed.

  • 0 Votes
    2 Posts

    For an automatic transition from www to no www, this code works well

    if ( $host ~ ^www.(?<domain>.+) ) {
    rewrite ^/(.*)$ $scheme://$domain/$1;

    Express.js does not support http/2. Or am I wrong? Does it make sense to include http/2 support in nginx?

  • 2 Votes
    1 Posts


    I wrote a tutorial about setting up single sign-on for NodeBB.

    Full disclosure, I wrote it using my employers OAuth server (FusionAuth) as the user identity provider.

    But the plugin and steps should work with any OAuth server. The plugin is here:

  • 7 Votes
    1 Posts
    Create & Manage a NodeBB Test/Dev Environment Table of Contents Summary Caveats Webserver Nginx NodeBB PRD -> DEV Adjustments to DEV Upgrading DEV NodeBB Delete DEV Fresh NodeBB with PRD database Summary

    The old saying goes

    Laws are like sausages, it is better not to see them being made.

    Managing NodeBB isn't as bad as that but there could be a bit of a challenge the first few times that you attempt to upgrade your software or install a new feature. Especially on your production system! So what can you do?

    Make a sausage factory of course! In our case the factory is a test/development environment to practice your upgrades or test a new plugin or CSS change. You do not necessarily need to spend additional money on a test/dev server, although you could. You can spin up a copy of your production system right on your production system. This is not very difficult due in part to how well NodeBB, and Node.js, were created.


    For disclosure I am not a developer of NodeBB or any of the supporting applications. These notes are just that, a collection of my notes as I was experimenting and learning. I do have twenty-four years of IT experience, mostly Unix (SunOS, Solaris, AIX, BSD, Linux) which includes twenty-four years of bad habits and ugly kludges. I do hope that in those years I have picked up a few gems and learned a few good traits. I will try to pass along only the best but please do accept the ugly as they come.

    My NodeBB forum runs on a Linux (CentOS) server. I utilize Redis as my NodeBB database and use Nginx as my web server. This document, unless noted otherwise, will reference that environment.

    I am making the assumption that you have a production NodeBB server that is fully operational and you wish to create a dev/test copy of it on the same server.

    And finally, The risk is yours. I do not take responsibility for harm to your system. Please evaluate all of my suggestions as you deem necessary.

    Webserver Nginx

    This addition should only need to be made once. After it is in place you should be able to create and delete dev NodeBB environments from your production without needing to adjust your Nginx configuration.

    You will need to make a new server block in your Nginx domain configuration file. Most likely located in /etc/nginx/sites-available/ This new server block will have the specifics for your dev NodeBB. For example you may create an entry like:

    server { listen 443 ssl; server_name; [...]

    In your location / { location block you will need a proxy_pass entry that directs to the port that your dev NodeBB will listen on:

    location / { [...] proxy_pass; [...]

    Once you have your Nginx configuration adjusted appropriately do not forget to restart it. sudo systemctl restart nginx.

    NodeBB PRD -> DEV

    For my examples the production NodeBB is running under the /opt/nodebb/ directory path and we will be creating a copy into /opt/devNodebb/

    Let's make a copy of production into dev. This can be done "live" without needing to shutdown your production forum.

    mkdir /opt/devNodebb (cd /opt/nodebb; tar cf - .) | (cd /opt/devNodebb; tar xvf -)

    If NodeBB was running when you made the copy you'll need to remove the pidfile. A pidfile typically contains the process id information of the running program. This is useful so that commands such as ./nodebb stop know which program to kill. The pidfile you copied over relates to the process id of your production NodeBB. You don't want to be killing that process when you try to startup your dev NodeBB.

    rm /opt/devNodebb/pidfile

    Since you made a copy of production you have all production information. If you attempted to start your dev NodeBB now you would have problems. You must edit your config.json file and tell it that you want a new instance of NodeBB.

    vi /opt/devNodebb/config.json

    Change your url, port and database entries. For the URL make it the dev domain that you configured your Nginx to listen for. For the port and database numbers I just incremented by one from production.

    "url": "", "port": "4568", [...] "database": "1"

    No you aren't ready to start up your dev NodeBB just yet. There isn't a database behind it.

    Let's make a copy of the production Redis database for dev to use. I use redis-copy which is not part of the redis database distribution. I downloaded and built my copy from this Github repository redis-copy.

    The following command makes a copy of the Redis database number 0 (production) to database number 1 (your dev/test). Database number 1 is the database we told the devNodebb config.json file above to use.

    redis-copy localhost/0 localhost/1

    Now we may startup the dev NodeBB instance.

    cd /opt/devNodebb ./nodebb start Adjustments to DEV

    Once your dev forum is running you should make a few administrative adjustments to it. These are not necessarily critical but they will help you to keep track of which system you are working on and may reduce notifications to your users, etc. Keep in mind that you cloned your production system which includes the users. If you do not want them logging into your dev system you should limit their exposure to it.

    You may want to adjust the site and browser title's to reflect a dev forum

    ACP > Settings > General > Site Title > DEV YourForumName ACP > Settings > General > Browser Title > DEV YourForumName

    Disable email subscriptions

    ACP > Settings > Email > Email Subscriptions > Disable subscriber notification emails

    Disable plugins that may cause confusion, such as Google Analytics

    ACP > Extend > Plugins > nodebb-plugin-google-analytics > Deactivate

    There may be other plugins that you wish to disable. Experimenting will lead you to adjust this list appropriately.

    There you have it. You now have a test/dev environment based off of your production system. Changes you make now will only be done in test/dev and your users will happily continue to use the production system until the time comes that you shutdown production to re-play changes or enhancements that you tested in dev.

    Upgrading DEV NodeBB

    So you went through all of the above steps and now you have, well, just a copy of production. Not really useful as it stands but now you have a platform to test upgrading without fear of damaging production.

    Let's upgrade! If you'd like to bring your dev NodeBB up to the current general release of NodeBB the following steps should be adequate.

    Stop your dev NodeBB

    cd /opt/devNodebb ./nodebb stop

    Tell Git to get the newest release information. This sets up NodeBB such that when you issue the upgrade command it will pull down all of the new or changed files as necessary.

    cd /opt/devNodebb git fetch git checkout v1.x.x git merge origin/v1.x.x

    Issue the NodeBB upgrade command

    cd /opt/devNodebb ./nodebb upgrade

    Watch for upgrade errors. Note that any customizations or changes you have made to your theme's CSS may have been undone by a new feature or bug fix. That is why we have this test/dev environment, so you can test and look for problems.

    If the upgrade appears to have worked without errors start up dev NodeBB and then switch into the logging mode so that you may watch the behavior of the system. Pressing ctrl-c will exit the logging mode.

    cd /opt/devNodebb ./nodebb start ./nodebb log Delete DEV

    What if there were problems with your upgrade or you'd like to start this process over with a fresh copy of production? That is not a big problem. A few commands will delete your test/dev environment and then you can start the copy process over again.

    Stop your dev NodeBB

    cd /opt/devNodebb ./nodebb stop

    Let's remove the test/dev software directory tree

    rm -rf /opt/devNodebb

    Delete the test/dev Redis database. This is probably the most dangerous command in this document. Please double check that the database number provided is the one for your test/dev environment and NOT the one for your production environment.

    redis-cli -n 1 flushdb

    And there you have it, test/dev is gone. You may now redo the PRD -> DEV or Fresh NodeBB with PRD database steps if you so desire.

    Fresh NodeBB with PRD database

    There may be times that you want to have a factory fresh NodeBB installation with your database content. You would end up with users, setttings, content, etc., but not files that you may have edited over time or plugins that you installed.

    Run the Delete DEV section to be sure you have no remnants of a previous test/dev environment. Then proceed.

    Tell Git to get the software and where to put it.

    git clone -b v1.x.x /opt/devNodebb

    Copy your production config.json file and then edit it as you would have if you were doing the PRD -> DEV section

    cp /opt/nodebb/config.json /opt/devNodebb/config.json vi /opt/devNodebb/config.json

    Change your url, port and database entries.

    "url": "", "port": "4568", [...] "database": "1"

    Copy over your Redis database

    redis-copy localhost/0 localhost/1

    Since the config.json has been created and contains the information that the NodeBB setup process would have asked for we can just run the NodeBB upgrade command (as opposed to the setup command). Bypassing the questions about which database to use, etc. Before you run the NodeBB upgrade you have to actually install the NodeBB software. This process was not necessary when we copied PRD to DEV earlier as it was done when you did your initial production NodeBB installation and was brought over in the tar copy process.

    cd /opt/devNodebb npm install ./nodebb upgrade

    Now start it up!

    cd /opt/devNodebb ./nodebb start

    And there you have it. You now have a clean installation of NodeBB with your database content. As noted in the PRD -> DEV section you may wish to make adjustments to your dev forum so that you can easily identify which one you are working in. Ie., change the site and browser title names, etc.

    Contact me Revision 1.2, 2016-APR-08
  • 4 Votes
    5 Posts

    Thank for sharing 😄