Multiple nodebb sites on the same server
-
Have you selected different databases in the config.json
-
@kurulumu-Net Also, I presume you have properly configured DNS records?
-
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 -
Steps:
- I create A record for two domains forum1.domain1.com and forum2.domain2.com for both forums. I confirm DNS forwarding.
- Create two different non-sudo users.
- Create two different databases in the first message.
- Make two separate nodeBB installations and enter separate database information for each installation.
- 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 -
@kurulumu-Net you can use nginx to listen on one port, but forward the traffic to two different ports based on the requested site.
-
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" }