• 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 !
    </IfModule>
    
    Alias /.well-known/acme-challenge /home/dogs/www/.well-known/acme-challenge
    
    ProxyPass / http://127.0.0.1:4567/
    ProxyPassReverse / http://127.0.0.1:4567/
    
    # 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

Suggested Topics

  • 10
  • 1
  • 9
  • 72
  • 3
| |