I want to make the ssh server on port 22 available through a subdomain on port 80.
I thought it should by something like this:
server {
listen ssh.domain.tld:80;
server_name ssh.domain.tld;
location / {
proxy_pass http://localhost:22;
}
}
But it won't work. nginx will accept this and start with this configuration, but I only get empty responses from ssh.domain.tld:80
.
What am I missing?
Since Nginx Version 1.9.0,NGINX support ngx_stream_core_module module, it should be enabled with the --with-stream. When stream module is enable they are possible to ssh protocol tcp proxy
stream {
upstream ssh {
server localhost:22;
}
server {
listen 80;
proxy_pass ssh;
} }
https://www.nginx.com/resources/admin-guide/tcp-load-balancing/
You should use sslh.
Configure nginx to run on a different port than 80, say 800, and then configure sslh to redirect web traffic to that port in /etc/default/sslh.conf
file.
This setup may take 15 min. or less.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With