r/selfhosted icon

Go to selfhosted

Reverse proxy SSH connection with nginx?

Thumbnail image: The everything app, for work. Get everyone working in a single platform designed to manage any type of work.

Why you want to proxy http?

proxy_pass http://$upstream;

When you talk about the stream module, than you should use the stream module.

stream {
    upstream ssh {
        server localhost:22;
    }
    server {
        listen 80;
        proxy_pass ssh;
    }
}

The question is why not change the port for ssh in ssh config if you proxy to localhost?

Ah thank you, I did not notice that! Unfortunately I will probably need to look for a different solution, as stream doesn't support subdomains (which makes sense). I will probably need to use an SSL tunnel instead.

More replies

Looks like that server block is a regular http block? If you're trying to get HTTPS and SSH on the same port, then you might want SSLH in front of Nginx and OpenSSH.

More replies More replies

sorry for digging out such an old topic, but what is the solution to making it work in Nginx Proxy Manager?