一台机器,一个端口映射到多个二级域名案例如下:
同一个listen端口映射到多个server_name上, 且server_name支持泛域名如*.domain.com
或多个域名如a.com,b.cn,c.top
。
# gitlab
server {
listen 443 ssl;
server_name gitlab.domain.com;
ssl_certificate /root/ca/cert.cer;
ssl_certificate_key /root/ca/cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
proxy_pass http://localhost:10080;
}
access_log logs/gitlab.access.log;
}
# jenkins
server {
listen 443 ssl;
server_name jenkins.domain.com;
ssl_certificate /root/ca/cert.cer;
ssl_certificate_key /root/ca/cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
proxy_pass http://localhost:18080;
}
access_log logs/jenkins.access.log;
}