Skip to content

Instantly share code, notes, and snippets.

@WoozyMasta
Created August 3, 2022 15:07
Show Gist options
  • Save WoozyMasta/3fcc9e5f7b6dd31ca211c0bcd5aee846 to your computer and use it in GitHub Desktop.
Save WoozyMasta/3fcc9e5f7b6dd31ca211c0bcd5aee846 to your computer and use it in GitHub Desktop.
SSL and SSH on the same port in Nginx
stream {
upstream ssh {
server 127.0.0.1:22;
}
upstream web {
server 127.0.0.1:443;
}
map $ssl_preread_protocol $upstream {
"" ssh;
"TLSv1.2" web;
default 127.0.0.1:443;
}
server {
listen 192.168.0.1:443;
proxy_pass $upstream;
ssl_preread on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment