Get nodebb working with virtual host and sub directory on apache2.4
-
One of the first issues I ran into getting nodebb working was getting it to play nice with my virtual host on apache. If you look at the documentation most of what you need is already there, but I wanted to get it working with my existing virtual host so I had to tweak it a bit.
here is the relevant code for apache:
<VirtualHost *:80> ServerAdmin admin@unogs.com ServerName unogs.com ServerAlias *.unogs.com ProxyRequests Off ProxyVia Off <Proxy *> Order deny,allow Allow from all </Proxy> # edit the next line if you use https RequestHeader set X-Forwarded-Proto "http" RewriteEngine On AllowEncodedSlashes On #important for the admin interface on nodebb RewriteCond %{REQUEST_URI} ^/forum/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /forum/(.*) ws://127.0.0.1:4567/forum/$1 [P,L] ProxyPass /forum/ http://127.0.0.1:4567/forum/ nocanon ProxyPassReverse /forum/ http://127.0.0.1:4567/forum/ DocumentRoot /mydocroot #where the rest of the site lives </VirtualHost>
The only real differences between this and the documentation are 'AllowEncodedSlashes On' which is necessary to get the admin interface working. and I have appended the '/' with '/forum/' to make only the forum sub directory reverse proxied.
Next, to get the sub directory working you need to change your nodebb config.json file to the following:
{ "url": "http://unogs.com/forum", "secret": "itsasecret", "database": "mongo", "port": "4567", "mongo": { "host": "127.0.0.1", "port": "27017", "username": "xxx", "password": "xxx", "database": "xxx" } }
I'm ashamed to say how long it took me to figure this out, but as you can see its working now.
-admin
-
This post is deleted! -
This post is deleted! -
This post is deleted! -
This post is deleted! -
This post is deleted!