Using NGINX I have multiple reverse proxies that work with normal http(s) for various websites. I have just one public ip address but several vhosts behind it. This part is working as it should.
I want to ssh into all of the hosts behind nginx, there are currently just three but more to come into the future.
As nginx is above version 1.9.1 I think was the version that allowed streams I have begun to configure for ssh, I will later want to add databases into the mix and maybe mail but for now ssh is the priority.
So, to begin I have added ssh_available and ssh_enabled to the nginx directory.
/etc/nginx/nginx.conf I have added the following:
stream {
include /etc/nginx/ssh_enabled/*;
}
/etc/nginx/ssh_available/domain.com.rproxy.conf I have the following:
upstream ssh {
server 192.168.1.61:22;
}
server {
listen 22;
proxy_pass ssh;
}
I have used the usual method of adding symlinks in ssh_enabled to the conf files in ssh_available.
This allows me to ssh into one host that is behind my nginx reverse proxy but one host only.
With this current configuration the SSH connection always lands on the same host no matter if I use the public IP, subdomain or fqdn.
How might I turn this into something more portable so that it can work with multiple host/domain names instead of just a single ip/domain?
What I want to happen is to ssh in using a domain and connect to the server that hosts it.