User Tools

Site Tools


SSH tunnel port forwarding

Access remote resource running on port 5555 locally on port 5001

ssh -L 5001:localhost:5555

Then type in web browser https://localhost:5001

Opposite: access local resource on port 3000 over public domain

ssh -R 8083:localhost:3000

Then type in browser “” to see local content on public domain. needs to be proxied by the webserver to 8083 port on server. is just the hostname, you can point any domain to the host where you are connecting with the tunnel.

nginx proxy example

server {
        include /etc/nginx/conf.d/ssl-conf;
        access_log /var/log/nginx/$host;
    location / {
        proxy_pass http://localhost:8083;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;

SSH keys need to be set up beforehand for both methods.

See also


wiki/ssh_tunnel_forwarding.txt · Last modified: 2021/06/04 10:51 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki