Skip to content

Instantly share code, notes, and snippets.

@diyfr
Last active June 28, 2024 01:55
Show Gist options
  • Save diyfr/fc89ffca050254c1b4c282d10e5710b6 to your computer and use it in GitHub Desktop.
Save diyfr/fc89ffca050254c1b4c282d10e5710b6 to your computer and use it in GitHub Desktop.
Apache conf for reverse proxy with HTTPS let's encrypt
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName subdomain.domain.ovh
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Include external config for specific locationInclude
Include /home/userapp/apache.conf/web.conf
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/ssl.error.log
CustomLog ${APACHE_LOG_DIR}/ssl.access.log combined
# Sample for Keycloak
ProxyPass /auth http://127.0.0.1:8080/auth
ProxyPassReverse /auth http://127.0.0.1:8080/auth
#Can ignore SSL Check on destination proxy example auto signed certificate on springboot
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLProxyCheckPeerName off
SSLProxyEngine On
SSLProxyVerify none
ProxyPreserveHost On
ProxyPass /secure https://127.0.0.1:8443/special_secure
ProxyPassReverse /secure https://127.0.0.1:8443/special_secure
RequestHeader set X-Forwarded-Proto https
# Let's encrypt
SSLCertificateFile /etc/letsencrypt/live/subdomain.domain.ovh/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.domain.ovh/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment