Recreate Apache settings for Lets Encrypt SSL.
#!/bin/bash
# curl -v google.com --proxy blog.defun.work:8888 --proxy-user proxy:PASS
# sudo a2enmod proxy proxy_http proxy_connect
set -x
# To meet uploading requirements.
apt install rsync
d=forward-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>
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
SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
Include /srv/www/letsencrypt/apache-ssl-options.conf
</VirtualHost>
</IfModule>
'EOF'
a2ensite $d
service apache2 reload