<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Get nodebb working with virtual host and sub directory on apache2.4]]></title><description><![CDATA[<p dir="auto">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 <a href="https://nodebb.readthedocs.io/en/latest/configuring/proxies/apache.html" rel="nofollow ugc">documentation</a> 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.</p>
<p dir="auto">here is the relevant code for apache:</p>
<pre><code>&lt;VirtualHost *:80&gt;
ServerAdmin admin@unogs.com
ServerName unogs.com
ServerAlias *.unogs.com
ProxyRequests Off
ProxyVia Off
&lt;Proxy *&gt;
        Order deny,allow
        Allow from all
&lt;/Proxy&gt;
# 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
&lt;/VirtualHost&gt;
</code></pre>
<p dir="auto">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.</p>
<p dir="auto">Next, to get the sub directory working you need to change your nodebb config.json file to the following:</p>
<pre><code>{
    "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"
    }
}
</code></pre>
<p dir="auto">I'm ashamed to say how long it took me to figure this out, but as you can see its working now.</p>
<p dir="auto">-admin</p>
]]></description><link>https://forum.uno.gs/topic/4/get-nodebb-working-with-virtual-host-and-sub-directory-on-apache2-4</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 00:26:31 GMT</lastBuildDate><atom:link href="https://forum.uno.gs/topic/4.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Jan 2017 08:15:01 GMT</pubDate><ttl>60</ttl></channel></rss>