Debug version of forward proxy.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 07 May 2023 13:24:09 +0300
changeset 22 5d4380dda5ad
parent 21 52f40bd9e114
child 23 7ec5ac6da905
Debug version of forward proxy.
deb/apache-register-forward-proxy.bash
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deb/apache-register-forward-proxy.bash	Sun May 07 13:24:09 2023 +0300
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -x
+
+# To meet uploading requirements.
+apt install rsync
+
+d=proxy
+mkdir -p /srv/www/$d
+chown user:user /srv/www/$d
+
+cat <<EOF >/etc/apache2/sites-available/$d.conf
+LoadModule proxy_module modules/mod_proxy.so
+LoadModule proxy_http_module modules/mod_proxy_http.so
+
+<VirtualHost $d.defun.work:*>
+    ProxyRequests On
+    ProxyVia On
+
+    Require ip 46.118
+
+    LogLevel info ssl:warn
+
+    ErrorLog ${APACHE_LOG_DIR}/error_forward_proxy.log
+    CustomLog ${APACHE_LOG_DIR}/access_forward_proxy.log
+</VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
+EOF
+
+a2ensite $d
+service apache2 reload