@sweetp glad to hear it 😎
Install NodeBB on subfolder
-
I have a wordpress site, let's call it
Website Domain Names, Online Stores & Hosting - Domain.comangle-down iconangle-down iconangle-down iconangle-down iconangle-down iconsearch iconsearch iconsearch iconsearch iconsearch icon
Finding the perfect website domain is as easy as 1-2-3. Buy a domain name, build and host a website, and enjoy our professional online marketing tools.
(domain.com)
Since the hosting company doesn't support Node.js, I have to install the forum on Google Cloud (Ubuntu VM) and put it under subdomain forum.domain.com.I use Cloudflare worker to point domain.com/forum to forum.domain.com, however all the links are broken (except for the assets - since I'm able to rewrite them all). For example, the categories link becomes domain.com/categories instead of domain.com/forum/categories, and so on.
I decide to install the forum on subfolder of the subdomain (ie: forum.domain.com/forum). By mimicking the subfolder, I hope the issue with the links will be gone. So far it looks good, the forum (domain.com/forum) shows the site without missing assets (CSS/JS/images). However, apparently there's an error with socket.io (Looks like your connection to the forum was lost, please wait while we try to reconnect).
Chrome Inspector shows repeater error with socket.io ( Failed to load resource: 404 /forum/socket.io/?EIO=3xxxxxx ). Same issue happens if I go straight to forum.domain.com/forum.
This is config.json:
{ "url": "http://forum.domain.com/forum/", "secret": "123", "database": "mongo", "port": "4567", "mongo": { "host": "127.0.0.1", "port": "27017", "database": "nodebb" }, "socket.io": { "origins": "http://forum.domain.com/forum:* http://forum.domain.com:*" } }
And this is NGINX config:
server { listen 80; server_name forum.domain.com; return 302 https://$server_name$request_uri; location /forum/ { 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_set_header X-Forwarded-Host $host; } }
Can anyone help me?
Thanks!
-
@Mickola your reasoning for using a subfolder on the subdomain doesn't seem to make much sense to me. Why don't you just have your forum at
forum.domain.com
and redirectdomain.com/forum
to that? -
HI @PitaJ ,
I don't want any redirection. For SEO purposes, I would like to keep everything within
Website Domain Names, Online Stores & Hosting - Domain.comangle-down iconangle-down iconangle-down iconangle-down iconangle-down iconsearch iconsearch iconsearch iconsearch iconsearch icon
Finding the perfect website domain is as easy as 1-2-3. Buy a domain name, build and host a website, and enjoy our professional online marketing tools.
(domain.com)
Thanks!
-
@Mickola then redirect
forum.domain.com
todomain.com/forum
.The following topic may help with the socket error:
-
@PitaJ, I saw that topic Re: Websocket error and already applied the suggestion as you can see from config.json.
The issue is, NodeBB is working when I put
Website Domain Names, Online Stores & Hosting - Domain.comangle-down iconangle-down iconangle-down iconangle-down iconangle-down iconsearch iconsearch iconsearch iconsearch iconsearch icon
Finding the perfect website domain is as easy as 1-2-3. Buy a domain name, build and host a website, and enjoy our professional online marketing tools.
(domain.com)
-
@julian & @PitaJ , thanks for your suggestion, it works now. I can access forum.domain.com/forum. The funny thing is nothing really changes from my original settings. I tested using Firefox and I don't see any 404 error, however, Chrome still shows the same error. But if I open it in Incognito mode, the error disappears.
Anyway, I still haven't been able to tackle the main issue. The objective is I like to run the nodeBB on subfolder of my Wordpress site. Since they're physically in different server (WP Engine for Wordpress site and Google Cloud for NodeBB), do you have any suggestions on how to achieve it?
Originally, I thought Cloudflare can solve the issue (See this article: https://blog.cloudflare.com/subdomains-vs-subdirectories-improved-seo-part-2/). So, I followed the steps, and managed to have
Domain.com | 404 Error | Domain.com
Small business web hosting offering additional business services such as: domain name registrations, email accounts, web services, online community resources and various small business solutions.
(domain.com)
The issue is always on websocket, I keep getting 404 not found on socket.io - even after applying what @julian suggested (adding domain.com/forum to origins). Any ideas?
-
@julian and @PitaJ ,
I guess there's a small progress. Now, instead of 404 error, I get 403 forbidden when accessingI change config.json url value to either: forum.domain.com/forum or domain.com/forum based on https://github.com/NodeBB/NodeBB/issues/5791
{ "url": "https://domain.com/forum/", "secret": "123", "database": "mongo", "port": "4567", "mongo": { "host": "127.0.0.1", "port": "27017", "database": "nodebb" }, "socket.io": { "origins": "https://forum.domain.com/forum:* https://forum.domain.com:* https://domain.com/forum:* https://domain.com:*" } }
Any directions?
-
First: try adding
config.https://domain.com:*
, nothttps://domain.com/forum
to yourI think it's likely that the cloudflare forwarding won't work with websockets.
I think you have two options:
-
Install both Wordpress and NodeBB on the same server. This shouldn't be too difficult, Wordpress is not very resource intensive. Then you can use nginx to handle both.
-
Run NodeBB under a subdomain.
I don't recommend this but it may be possible to reverse proxy between the two servers. Either WP -> NBB or NBB -> WP. I'd recommend you have https when communicating between the two servers.
-
-
-
@julian I was suggesting installing his own WordPress setup on the same server as NodeBB, which is entirely possible but not easy by any means.
-
@julian, if you see my config.json,
Website Domain Names, Online Stores & Hosting - Domain.comangle-down iconangle-down iconangle-down iconangle-down iconangle-down iconsearch iconsearch iconsearch iconsearch iconsearch icon
Finding the perfect website domain is as easy as 1-2-3. Buy a domain name, build and host a website, and enjoy our professional online marketing tools.
(domain.com)
Well, I guess the best option is to put the Wordpress site on the same server as NodeBB. I don't think it's going to be this complicated ;). Thanks for your help, @julian & @PitaJ