Guide correction: Apache2.4 Proxy config is innaccurate



  • After working on setting up my NodeBB in a Linode server, I struggled to get an apache reverse proxy that would allow me to setup the NodeBB as a 'forum' subdomain (ie forum.example.com). I tired using the proxy configuration guide in the documentation, but it really doesn't work. So here are some suggestions on how to improve it.

    The required apache module section is fine.

    The configuration for the virtual host section needs a clearer example, so here is my example of how to set up the virtualhost.conf file. This is specifically for setting up NodeBB in a subdomain, but it should be pretty obvious how to set it up for a regular domain.

    <VirtualHost example.com:80>
    ServerAdmin example@gmail.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html/
    ErrorLog /var/www/example.com/logs/error.log
    CustomLog /var/www/example.com/logs/access.log combined
    </VirtualHost>

    ProxyRequests off

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

    <VirtualHost forum.example.com:80>
    ServerAdmin example@gmail.com
    ServerName forum.example.com
    ServerAlias forum.example.com

    ProxyPass /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocket
    ProxyPassReverse /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocket
    
    ProxyPass /socket.io/ http://127.0.0.1:4567/socket.io/
    ProxyPassReverse /socket.io/ http://127.0.0.1:4567/socket.io/
    
    ProxyPass / http://127.0.0.1:4567/
    ProxyPassReverse / http://127.0.0.1:4567/
    

    </VirtualHost>

    Finally, the config.json file bit is fine. I guess it's just the virtualhost configuration file piece that needs adjustment IMHO.


  • Global Moderator

    You can submit a PR for the docs here



  • I have submitted the change.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.