Skip to content

Instantly share code, notes, and snippets.

@notflip
Created December 5, 2020 08:26
Show Gist options
  • Save notflip/7c39fe8e671139679f16e1df5a191bc0 to your computer and use it in GitHub Desktop.
Save notflip/7c39fe8e671139679f16e1df5a191bc0 to your computer and use it in GitHub Desktop.
SSH Tunnel with AutoSSH Keep Alive
# .ssh/config
Host tunnel-notflip
Hostname tunnel.notflip.be
User root
IdentityFile ~/.ssh/id_rsa
RemoteForward 20000 localhost:8000
ServerAliveInterval 30
ServerAliveCountMax 3
# .zshrc (or .bashrc)
alias tunnel="AUTOSSH_DEBUG=1 autossh -M 0 -T -N tunnel-notflip"
# On Server /etc/nginx/sites-available/tunnel.notflip.be
server {
server_name tunnel.notflip.be;
listen 80;
location / {
proxy_pass http://127.0.0.1:20000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment