Apache2 Reverse-Proxy for NodeBB - Snippet

  • Hello Guys!

    I was trying to get Apache2 to work as a proxy. Finally I did it but I have had a few issues:

    • first It wasn't reachable at all
    • then Images just fetched still in HTTP
    • suddenly I had problems with WebSockets, they didn't work
    • with this fixed: login wasn't working anymore
    • with this fixed I wasn't able to use https:// in my config.json
    • .. and so on and so an

    I struggled about 3 hours to get it work. Now my NodeBB-instance is running under the hood of Apache2 - delivered by a subdomain. Everything is working. So I just want to share my Apache2 configuration so that you do not have to struggle with the same things.

    Apache2 configuration:

    <IfModule mod_proxy.c>
            ProxyPass /.well-known/acme-challenge !
    Alias /.well-known/acme-challenge /home/dogs/www/.well-known/acme-challenge
    ProxyPass /
    ProxyPassReverse /
    # Required for websockets
    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:4567%{REQUEST_URI} [P]
    # Required to tell its external port
    RequestHeader set X-Forwarded-Port "443"
    RequestHeader set X-Forwarded-Proto "https"

    Maybe you can remove

    Alias /.well-known/acme-challenge /home/dogs/www/.well-known/acme-challenge or change it to another path! 🙂

    For SSL-Encryption you can simply use certbot or whatever. Apache2 is still fully customizable and only works as a reverse proxy.

    Bye bye

  • @dogs Curious, had you seen this https://docs.nodebb.org/configuring/proxies/apache/

    Something there not working for you? Inquiring minds are curious. 🐕

  • @gotwf I'm not sure it's been weeks ago I wrote this. 😄

    Maybe I did not find this or something didn't work for me. I can't tell you...


Suggested Topics

  • 0 Votes
    1 Posts
  • 0 Votes
    7 Posts
  • NodeBB - Getting ads working

  • Setting up NodeBB on cloud 9

    10 Votes
    15 Posts
  • 0 Votes
    18 Posts