Multiple nodebb sites on the same server

  • Global Moderator Plugin & Theme Dev

    Have you selected different databases in the config.json

  • Community Rep

    @kurulumu-Net Also, I presume you have properly configured DNS records? 👍

  • Global Moderator Plugin & Theme Dev

    It also looks like you only have one server block in your nginx config.


  • They are different scripts. Accordingly, they should have different database names, different ports, different nodebb services, different nginx conf files.
    And preferably different users


  • @volanar

    Steps:

    1. I create A record for two domains forum1.domain1.com and forum2.domain2.com for both forums. I confirm DNS forwarding.
    2. Create two different non-sudo users.
    3. Create two different databases in the first message.
    4. Make two separate nodeBB installations and enter separate database information for each installation.
    5. Create forum1.conf and forum2.conf nginx conf.

    In the result browser both domains show the same nodebb instance.

    As file path in Nginx conf file;

    first site nginx.conf

    server {
         listen [::]:443 ssl ipv6only=on;
         listen 443 ssl;
    
             ssl_certificate /etc/ssl/cert.pem;
             ssl_certificate_key /etc/ssl/key.pem;
            ssl_client_certificate /etc/ssl/cloudflare.crt;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
    root /home/user1/nodebb/public;
    
    server_name forum1.domain1.com;
    .
    .
    .
    

    first site nginx.conf

    server {
         listen [::]:443 ssl ipv6only=on;
         listen 443 ssl;
    
             ssl_certificate /etc/ssl/cert2.pem;
             ssl_certificate_key /etc/ssl/key2.pem;
             ssl_client_certificate /etc/ssl/cloudflare.crt;
             ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
    root /home/user2/nodebb/public;
    
    server_name forum1.domain1.com;
    .
    .
    .
    

  • @kurulumu-Net forum 1 port 4567, forum2 port 45xx.
    2 different platforms cannot use the same port


  • @volanar ahh yes you are right. I'll have to use a different reverse proxy for the second forum then.

  • Global Moderator Plugin & Theme Dev

    @kurulumu-Net you can use nginx to listen on one port, but forward the traffic to two different ports based on the requested site.


  • @PitaJ Is there a sample configuration?

  • Community Rep

    nginx.confs

    server {
      server_name serenitymc.net;
    
      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_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";
      }
    
      listen [::]:443 ssl ipv6only=on;
      listen 443 ssl;
      include serenitymc.ssl;
    }
    
    server {
      server_name onpu.serenitymc.net;
    
      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_pass http://127.0.0.1:4566;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
      }
    
      listen [::]:443 ssl;
      listen 443 ssl;
      include serenitymc.ssl;
    }
    

    config.json

    {
        "url": "https://serenitymc.net",
        "secret": "xxx",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebb-serenity",
            "password": "xxx",
            "database": "nodebb-serenity"
        },
        "port": "4567"
    }
    
    {
        "url": "https://onpu.serenitymc.net",
        "secret": "xxx",
        "database": "mongo",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebb-onpu",
            "password": "xxx",
            "database": "nodebb-onpu"
        },
        "port": "4566"
    }
    
  • GNU/Linux Gamers

    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.


Suggested Topics

  • 3
  • 3
  • 5
  • 12
  • 83
| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.