Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
/ nginx-ssh-tunnel Public archive

reverse proxy with nginx and ssh: tunnel http(s) traffic (to localhost) with nginx and ssh

License

Notifications You must be signed in to change notification settings

bukowa/nginx-ssh-tunnel

Repository files navigation

Docker Repository on Quay Workflow

Tunnel http(s) traffic from internet facing endpoint into your machine via SSH.

I use it to redirect http traffic from server into localhost port 80, for example; pass all traffic landing on *.example.com to localhost:80:

Server:

docker run \
  --restart=always \
  --network=host \
  --volume=$PWD/certs:/certs \
  -e SERVER="*.example.com" \
  -e TUNNEL_PORT=5600 \
  -e TUNNEL_HOST="localhost" \
  -d \
  --name=http-proxy \
  \
  quay.io/k8start/nginx-ssh-tunnel \
  \
  && \
  docker logs -f http-proxy

Localhost:

ssh:

ssh -R 5600:localhost:80 <user>@<server>

autossh:

autossh -M 0 -N -R 5000:localhost:80 <user>@<server>