I use Nginx to redirect my domains coming on port 80 to the correct virtual machines, now I'm wondering if I can do this with ssh on port 22. Redirect all ssh traffic to the correct guests through port 22?
No, you can't do that. It works for HTTP, because the protocol supports name based virtual hosts. SSH doesn't.
You can do this through ssh's
You then connect to the different internal remote servers like this:
This is the tip of the iceberg as far as this feature goes. Check out this U&L Q&A titled: SSH tunnel through middleman server - how to connect in one step (using key pair)?, for more details.
NOTE: The above method is making use of a tool called
This isn't exactly the same as Nginx's redirection, you're tunneling through the external system to get to the internal system, but it has a similar effect.