Skip to content

Instantly share code, notes, and snippets.

@agoldis
Created February 13, 2017 22:03
Show Gist options
  • Save agoldis/c6d5660131c263e93d6d23115a21cf10 to your computer and use it in GitHub Desktop.
Save agoldis/c6d5660131c263e93d6d23115a21cf10 to your computer and use it in GitHub Desktop.
nginx proxy for ssh tunnelling
#!/bin/bash
port=ARGV[1]
ssh -R $port:localhost:$port sshproxy
server {
server_name "~^(?<port>\d{4,5})\.port\.goldis\.io$";
location / {
proxy_pass http://127.0.0.1:$port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment