From 8b8262a9676ee6356a14f36fb5fe4563ecc03a51 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 25 Oct 2021 14:13:46 +0100 Subject: [PATCH] Add Apache2 instructions --- reverse-proxy/README.md | 12 ++++++++++++ reverse-proxy/apache2/plausible.conf | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 reverse-proxy/apache2/plausible.conf diff --git a/reverse-proxy/README.md b/reverse-proxy/README.md index 6a29eb3..0583841 100644 --- a/reverse-proxy/README.md +++ b/reverse-proxy/README.md @@ -33,3 +33,15 @@ Edit the file `reverse-proxy/traefik/docker-compose.traefik.yml` to contain the ```shell $ docker-compose -f docker-compose.yml -f reverse-proxy/traefik/docker-compose.traefik.yml up ``` + +### Apache2 +Install the necessary Apache modules and restart Apache. Edit the file `reverse-proxy/apache2/plausible.conf` to contain the domain name you use for your server, then copy it into Apache's configuration folder. Enable it by creating a symlink in Apache's enabled sites folder with `a2ensite` command. Finally use Certbot to create a TLS certificate for your site: + +```shell +$ sudo a2enmod proxy proxy_http proxy_ajp remoteip headers +$ sudo systemctl restart apache2 +$ sudo cp reverse-proxy/apache2/plausible.conf /etc/apache2/sites-available/ +$ sudo a2ensite plausible.conf +$ sudo systemctl restart apache2 +$ sudo certbot --apache +``` \ No newline at end of file diff --git a/reverse-proxy/apache2/plausible.conf b/reverse-proxy/apache2/plausible.conf new file mode 100644 index 0000000..9354436 --- /dev/null +++ b/reverse-proxy/apache2/plausible.conf @@ -0,0 +1,18 @@ + + + ServerAdmin admin@example.com + ServerName example.com + + ProxyPreserveHost On + ProxyPass / http://localhost:8000/ + ProxyPassReverse / http://localhost:8000/ + + SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" forwarded + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined env=!forwarded + CustomLog ${APACHE_LOG_DIR}/access.log forwarded env=forwarded + +