Configure nodeBB domain

Technical Support
  • I am wondering how do I configure nodeBB to be under my domain I already have registered. I use DigitalOcean to configure the nodebb under ubuntu. I used this guide: https://docs.nodebb.org/installing/os/ubuntu/

  • Install Nginx

    $ sudo apt-get update
    $ sudo apt-get install nginx
    That’s it, Nginx is now installed and you can do the usual start, stop and restart with the following command:

    $ service nginx start
    $ service nginx stop
    $ service nginx stop
    Configure Nginx

    Nginx is going to act like a reverse proxy for your domain. When a user types in your-domain, they are going to serves the pages from your-ip:4567. To do this, you will need to navigate to your configuration file.

    $ cd /etc/nginx/sites-available/
    Personally, I remove the configuration and create a new one.

    $ rm default
    $ nano default
    Inside the configuration file I use the following:

    server {
    listen 80;

    server_name domain.com;
    
    location / {
    root /var/www/nodebb;
        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://127.0.0.1:4567/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    

    }
    You will need to change domain.com to your own domain name and the root path to wherever you installed NodeBB.

  • We recommend using nginx, you can check out the nginx documentation here: https://docs.nodebb.org/configuring/proxies/nginx/

  • When I used the guide to point it to my domain it just gives me an error.

    ● nginx.service - A high performance web server and a reverse proxy server
    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2018-04-15 18:09:47 BST; 1min 18s ago
    Docs: man:nginx(8)
    Process: 5355 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exite
    Process: 5018 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCES
    Process: 5293 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 5421 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
    Main PID: 5296 (code=exited, status=0/SUCCESS)

    Apr 15 18:09:47 35thid systemd[1]: Starting A high performance web server and a reverse proxy server...
    Apr 15 18:09:47 35thid nginx[5421]: nginx: [emerg] invalid number of arguments in "root" directive in /etc/nginx/si
    Apr 15 18:09:47 35thid nginx[5421]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Control process exited, code=exited status=1
    Apr 15 18:09:47 35thid systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Unit entered failed state.
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Failed with result 'exit-code'.
    lines 1-17/17 (END)
    ● nginx.service - A high performance web server and a reverse proxy server
    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2018-04-15 18:09:47 BST; 1min 18s ago
    Docs: man:nginx(8)
    Process: 5355 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0
    Process: 5018 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
    Process: 5293 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 5421 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
    Main PID: 5296 (code=exited, status=0/SUCCESS)

    Apr 15 18:09:47 35thid systemd[1]: Starting A high performance web server and a reverse proxy server...
    Apr 15 18:09:47 35thid nginx[5421]: nginx: [emerg] invalid number of arguments in "root" directive in /etc/nginx/sites-enabled
    Apr 15 18:09:47 35thid nginx[5421]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Control process exited, code=exited status=1
    Apr 15 18:09:47 35thid systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Unit entered failed state.
    Apr 15 18:09:47 35thid systemd[1]: nginx.service: Failed with result 'exit-code'.

  • There's an error in your nginx config. You can use nginx -t to find the problem.

  • This is what comes up when I type that.

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

  • This post is deleted!
  • It's fixed it was not linked properly.


Suggested Topics


  • 0 Votes
    12 Posts
    2975 Views
  • 0 Votes
    6 Posts
    2648 Views
  • Merging nodebb forums

    Technical Support
    0 Votes
    1 Posts
    1090 Views
  • 2 Votes
    1 Posts
    855 Views
  • -1 Votes
    21 Posts
    4693 Views