HOW-TO: Apache2 SSL Proxies

From Tayledras
Jump to: navigation, search

Configuring Apache2 RewriteEngine and Proxy

/etc/apache2/sites-available/wiki-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/wiki/
     ServerName kenforeman.dnsdojo.com
     ServerAlias kenforeman.dnsdojo.com
     SSLEngine On

     RewriteEngine On
     RewriteCond %{HTTPS} !=on
     RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

     SSLProxyEngine On
     SSLProxyVerify None
     SSLProxyCheckPeerName Off
     SSLProxyCheckPeerExpire off
     ProxyPass "/wiki" "https://ares.foreman.home/wiki"
     ProxyPassReverse "/wiki" "https://ares.foreman.home/wiki"

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/wiki/
     ServerName tayledras.dnsdojo.com
     ServerAlias tayledras.dnsdojo.com
     SSLEngine On

     RewriteEngine On
     RewriteCond %{HTTPS} !=on
     RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

     SSLProxyEngine On
     SSLProxyVerify None
     SSLProxyCheckPeerName Off
     SSLProxyCheckPeerExpire off
     ProxyPass "/wiki" "https://ares.foreman.home/wiki"
     ProxyPassReverse "/wiki" "https://ares.foreman.home/wiki"

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/wiki/
     ServerName ares.foreman.home
     ServerAlias ares.foreman.home
     SSLEngine On

     RewriteEngine On
     RewriteCond %{HTTPS} !=on
     RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kenforeman.dnsdojo.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>