Skip to content

Instantly share code, notes, and snippets.

@imylomylo
Last active December 13, 2018 10:33
Show Gist options
  • Save imylomylo/630aa6358459f0fa57b8e8fd1a0678fd to your computer and use it in GitHub Desktop.
Save imylomylo/630aa6358459f0fa57b8e8fd1a0678fd to your computer and use it in GitHub Desktop.
proxy virtualhost
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo systemctl restart apache2
<VirtualHost *:443>
SSLEngine on
RequestHeader set X-Forwarded-Proto 'https'
ServerName some.domain.com
ServerAlias some.domain.net
DocumentRoot "/var/www/some.domain.com/htdocs"
ProxyPass /git http://127.0.0.1:7999/git
ProxyPassReverse /git http://127.0.0.1:7999/git
ProxyPass /zabbix http://172.30.4.36/zabbix
ProxyPassReverse /zabbix http://172.30.4.36/zabbix
ProxyPass /forum http://127.0.0.1:4567/forum
ProxyPassReverse /forum http://127.0.0.1:4567/forum
ProxyPreserveHost on
<Directory "/var/www/some.domain.com/htdocs">
Options -Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/some.domain.com/htdocs/simplepwprotected">
Options +Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
AuthType Digest
AuthName "chrisb private"
AuthDigestProvider file
AuthUserFile "/etc/apache2/sites-enabled/simplepwstore"
Require valid-user
</Directory>
<Location "/web/database">
Deny from all
</Location>
<Location "/wiki">
ProxyPass !
</Location>
<Directory "/var/www/some.domain.com/htdocs/wiki/images">
Options -Indexes
</Directory>
ErrorLog "|/usr/bin/cronolog /var/www/some.domain.com/logs/%Y-%m-%d/error_log"
CustomLog "|/usr/bin/cronolog /var/www/some.domain.com/logs/%Y-%m-%d/access_log" combined
SSLCertificateFile /etc/letsencrypt/live/some.domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/some.domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/some.domain.com/chain.pem
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment