Search code examples
apachejoomlaproxyreverse

Using Joomla on Apache behind Apache Reverse Proxy


I have a Joomla Installation on Apache2 (Port 83) running on Ubuntu 16.04 Server. When I connect to the page from the local network like 192.168.178.14:83 it appears and everything is fine. To access my page from the Internet there is another Server running Apache2, that acts as a Proxy Server. All traffic going trough Port 80 and 443 come to this machine, using the ServerName it decide to which machine the traffic have to be forwarded. That's working fine for about 10 domains and machines. But when I connect to my Joomla Domain I get a HTML Site without any formatting, graphics and templates. When I forward a Port directly to this machine everything works fine again, using this port to connect. network topologie

My VirtualHost config on Ubuntu1:

<VirtualHost *:80>
   ServerName ksg-events.de
   Redirect permanent / https://ksg-events.de/
</VirtualHost>

<VirtualHost *:443>
    ServerName ksg-events.de
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia Off
    ProxyPass / http://192.168.178.14:83/
    ProxyPassReverse / http://192.168.178.14:83/
    SSLCertificateFile /etc/letsencrypt/live/ksg-events.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ksg-events.de/privkey.pem
</VirtualHost>

Virtual Host config on Ubuntu2:

<VirtualHost *:83>
        DocumentRoot /var/www/ksg-events.de/joomla
</VirtualHost>

Thanks for your help!


Solution

  • I find a solution to my problem:

    Run Joomla behind Apache reverse proxy (http):

    • Add ProxyVia full to proxy's VirtualHost config

    Using https:

    • Enable mod_headers on proxy server
    • Add RequestHeader set X-Forwarded-Proto "https" to proxy's VirtualHost

    I hope that can help someone who run into the same problems.