1. 申请两个免费证书: 1. example.com 证书 2.test.example.com 证书
2. nginx 主要配置除证书路径不一致,其他一致 省略部分location配置
server {
#listen 443 ssl;
listen 443;
server_name mrsetng.com;
ssl on;
# 证书文件路径
ssl_certificate /data/cert/mrsetng/2398232_www.test.com.pem;
# 私钥文件路径
ssl_certificate_key /data/cert/mrsetng/2398232_www.test.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
root /data/server;
charset utf-8;
access_log /data/server/logs/test.access.log main;
#对 / 所有做负载均衡+反向代理
location / {
}
}
3. 当一级域名和二级域名的配置都打开,打开浏览器查看一级域名的证书居然是二级域名的
把二级域名配置注释,一级域名打开浏览器访问正常,证书也正常