< Nginx
stream{
upstream ssh {
server 127.0.0.1:22;
}
upstream web {
server 127.0.0.1:80;
}
map $ssl_server_name $srv_name {
~(.+)\.ssh ssh;
default web;
}
server {
listen port ssl;
proxy_pass $srv_name;
ssl_preread on;
ssl_certificate /etc/letsencrypt/live/ossmedia.cn/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ossmedia.cn/privkey.pem; # managed by Certbot
}
}
stream{
upstream ssh {
server 127.0.0.1:22;
}
upstream web {
server 127.0.0.1:80;
}
map $ssl_preread_protocol $upstream {
default web;
"" ssh;
"TLSv1.0" web;
"TLSv1.1" web;
"TLSv1.2" web;
"TLSv1.3" web;
}
server {
listen port;
proxy_pass $upstream;
ssl_preread on;
}
}