Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chrono-meter/64610c38a52179d7d1e6628688d78844 to your computer and use it in GitHub Desktop.
Save chrono-meter/64610c38a52179d7d1e6628688d78844 to your computer and use it in GitHub Desktop.
Apache reverse proxy via Putty port forward.

⚠️ Fix weak security before expose.

Add apache setting.

HOST="your-host.example.com"; FORWARD_URL="http://127.0.0.1:10080/"
sudo tee -a /etc/apache2/sites-enabled/$HOST.conf <<EOT
<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / $FORWARD_URL
    ProxyPassReverse / $FORWARD_URL
    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    ServerName $HOST
</VirtualHost>
EOT
sudo a2enmod proxy proxy_http headers
sudo a2ensite $HOST.conf
sudo systemctl restart apache2
sudo certbot --apache -d $HOST

Next, forard a port by Putty.

putty -R 10080:127.0.0.1:80

Unable to login. Infinite login page loop.

Clear cookie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment