josie / simplegit

# simplegit reverse proxy (Apache httpd + Let's Encrypt)
# Installed by scripts/install.sh with the domain substituted.
# Edit ServerName here if the derived domain is wrong.

<VirtualHost *:80>
    ServerName {{DOMAIN}}
    DocumentRoot /var/www/html
    <Location "/.well-known/acme-challenge/">
        Require all granted
    </Location>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</VirtualHost>

<VirtualHost *:443>
    ServerName {{DOMAIN}}
    SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/{{DOMAIN}}/fullchain.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/{{DOMAIN}}/privkey.pem

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyTimeout 600s
    Timeout      600
    AllowEncodedSlashes NoDecode

    SetEnv no-gzip 1
    SetEnv dont-vary 1
    LimitRequestBody 0

    ProxyPass        / http://{{LOOPBACK}}:8080/ retry=0
    ProxyPassReverse / http://{{LOOPBACK}}:8080/

    ErrorLog  ${APACHE_LOG_DIR}/simplegit-error.log
    CustomLog ${APACHE_LOG_DIR}/simplegit-access.log combined
</VirtualHost>