0

I've set up an Ubuntu virtual machine using VirtualBox which I'm trying to configure to run Apache2, PHP, MySQL, NodeJS and MongoDB for WordPress and NodeBB.

All of the above are installed, configured and working as expected:

http://localhost loads up the WordPress default site

http://localhost:4567 loads up the NodeBB forum

Now, what I would like to do is to configure the VM so that it mimics my "live" site - for this post, lets say my domain is example.com with the WordPress site catching all primary domain requests and the subdomain forum.example.com redirecting to the NodeBB site.

Having followed MANY guides on how to set this up (on SU, NodeBB, Apache forums, etc), I'm having ZERO success getting the subdomain to work at all.

Here's what I have done so far:

  1. Edited the /etc/hosts file to include the line 127.0.0.1 example.com and I can verify that any request to example.com always results in the WordPress site being shown
  2. Created the /etc/apache2/sites-available/forum.example.com.conf file for the forum virtual host, including the following content:

```

<VirtualHost *:80>
ServerName forum.example.com
RequestHeader set X-Forwarded-Proto "http"

ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/socket.io               [NC]
RewriteCond %{QUERY_STRING} transport=websocket       [NC]
RewriteRule /(.*)           ws://127.0.0.1:4567/$1    [P,L]

ProxyPass / http://127.0.0.1:4567/
ProxyPassReverse / http://127.0.0.1:4567/
</VirtualHost>

```

  1. I've updated the NodeBB config.json file, changing the url value to http://forum.example.com

Having restarted Apache2 and NodeBB, I can confirm that the WordPress site still loads when visiting example.com however the forum.example.com subdomain never loads. NodeBB is still accessible on localhost:4567.

Obviously, the configuration of the virtualhost is incorrect however the content/configuration of said file was taken from a number of "working" sources off the web.

Any suggestions would be very welcome, thanks.

1 Answer 1

0

Edit the /etc/hosts file to include the line

127.0.0.1 example.com forum.example.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .