{{item}}
{{item.title}}
{{items.productName}}
{{items.price}}/年
{{item.title}}
部警SSL证书可实现网站HTTPS加密保护及身份的可信认证,防止传输数据的泄露或算改,提高网站可信度和品牌形象,利于SEO排名,为企业带来更多访问量,这也是网络安全法及PCI合规性的必备要求
前往SSL证书在企业数字化架构中,多产品子站(如 product1.example.com 、 product2.example.com )的安全防护是网络安全体系的重要组成部分。为每个子站单独部署SSL证书不仅会增加管理成本,还可能因证书版本不一致导致安全漏洞。本文将详细介绍如何为多个产品子站部署统一的SSL证书,涵盖证书选型、部署流程、配置技巧及验证方法,帮助企业实现高效、安全的证书管理。
为多个产品子站部署统一SSL证书,核心是选择支持多域名或子域名的证书类型。目前主流方案有两种,需根据子站的域名结构选择:
(1)适用场景:所有子站均基于同一主域名(如 *.example.com 可覆盖 product1.example.com 、 admin.example.com 等所有二级子站)。
(2)优势:
(3)局限性:仅支持同一主域名下的子站,无法覆盖独立域名(如 example.net 、 example.org )。
(1)适用场景:子站基于不同主域名(如 product1.example.com 、 service.example.cn 、 app.example.net )。
(2)优势:
(3)局限性:新增子站时需重新向CA申请扩展域名(可能产生额外费用),管理流程略复杂。
| 子站域名结构 | 推荐证书类型 | 典型用户 | 
|---|---|---|
| 统一主域名下的多子站(*.example.com) | 通配符SSL证书 | 通配符 SSL 证书 | 
| 跨主域名的多子站(a.com、b.cn) | 多域名SSL证书 | 集团企业、多品牌业务线 | 
注意:无论选择哪种类型,均需确保证书的验证级别(DV/OV/EV)符合业务需求。例如,金融类子站需选择OV/EV级证书以增强用户信任,而内部管理子站可使用DV级证书降低成本。
为确保统一证书在所有子站正常生效,需提前确认以下环境条件:
(1)服务器环境统一性
(2)域名解析验证
(3)端口与防火墙配置
以通配符SSL证书(最常用场景)为例,申请流程如下:
(1)生成CSR文件:
1    # 生成私钥(所有子站共用同一私钥)
2    openssl genrsa -out wildcard_example_com.key 2048
3
4    # 生成 CSR(Common Name填写*.example.com)
5    openssl req -new -key wildcard_example_com.key -out wildcard_example_com.csr(2)选择CA并提交申请:
(3)获取证书文件:
1)服务器证书(如 wildcard_example_com.crt )。
2)中间证书(如 ca-bundle.crt ,用于验证证书链完整性)。
假设企业有三个子站: product1.example.com 、 product2.example.com 、 api.example.com ,均基于Nginx服务器,使用通配符证书 *.example.com 。
(1)证书文件分发:
1    # 示例:通过scp分发到子站服务器
2    scp /local/path/wildcard_example_com.* user@product1.example.com:/etc/nginx/ssl/
3    scp /local/path/ca-bundle.crt user@product1.example.com:/etc/nginx/ssl/(2)子站配置文件修改:
1    server {
2        listen 80;
3        server_name product1.example.com;
4        # 强制 HTTP 跳转 HTTPS(可选但推荐)
5        return 301 https://$host$request_uri;
6    }
7
8    server {
9        listen 443 ssl;
10      server_name product1.example.com;
11    
12      # 统一证书路径(所有子站相同)
13      ssl_certificate /etc/nginx/ssl/wildcard_example_com.crt;
14      ssl_certificate_key /etc/nginx/ssl/wildcard_example_com.key;
15      ssl_trusted_certificate /etc/nginx/ssl/ca-bundle.crt;
16    
17      # 通用SSL安全配置(所有子站共用)
18      ssl_protocols TLSv1.2 TLSv1.3;
19      ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
20      ssl_prefer_server_ciphers on;
21      ssl_session_cache shared:SSL:10m;
22    
23      # 子站特有配置(如根目录、反向代理)
24      root /var/www/product1;
25      index index.html;
26  }(3)配置生效与错误排查:
1  nginx -t  # 先验证配置语法
2  nginx -s reload1)“SSL_CTX_use_PrivateKey_file failed”:私钥文件路径错误或权限不足(需确保权限为 600)。
2)“server name does not match certificate”:子站域名不在证书保护范围内(如证书为 *.example.com ,但子站为 product1.test.example.com ,需检查通配符层级是否匹配)。
对于Apache服务器,统一证书的部署核心是在虚拟主机配置中引用相同的证书文件。
(1)启用SSL模块:
1    a2enmod ssl  # Debian/Ubuntu
2    systemctl restartApache2(2)配置虚拟主机:
1    <VirtualHost *:443>
2        ServerName product1.example.com
3    
4        # 统一证书配置
5        SSLEngine on
6        SSLCertificateFile /etc/apache2/ssl/wildcard_example_com.crt
7        SSLCertificateKeyFile /etc/apache2/ssl/wildcard_example_com.key
8        SSLCertificateChainFile /etc/apache2/ssl/ca-bundle.crt
9    
10      # 子站特有配置
11      DocumentRoot /var/www/product1
12      <Directory /var/www/product1>
13          AllowOverride All
14          Require all granted
15      </Directory>
16  </VirtualHost>
17
18  # HTTP 跳转 HTTPS(可选)
19  <VirtualHost *:80>
20      ServerName product1.example.com
21      Redirect permanent / https://product1.example.com/
22  </VirtualHost>(3)验证配置:
当子站数量超过 10 个时,手动部署和更新证书会面临效率瓶颈。以下是批量管理的最佳实践:
1    # 示例:将证书目录挂载到所有子站服务器
2    mount -t nfs storage.example.com:/ssl-shared /etc/ssl/certs/1    # 批量同步证书到子站列表
2    for subdomain in product1 product2 api; do
3        rsync -av /local/ssl/* user@$subdomain.example.com:/etc/nginx/ssl/
4        ssh user@$subdomain.example.com "Nginx-s reload"
5    done对于使用Let's Encrypt免费证书的企业,可通过Certbot工具实现自动化续期(通配符证书支持DNS验证自动化):
(1)安装Certbot并配置DNS插件(以Cloudflare DNS为例):
1    # 安装Certbot及Cloudflare插件
2    apt install certbot python3-certbot-dns-cloudflare
3
4    # 配置Cloudflare API密钥(用于自动添加TXT记录)
5    cat > /root/cloudflare.ini << EOF
6    dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN
7    EOF
8    chmod 600 /root/cloudflare.ini(2)生成自动续期脚本:
1    # 创建续期脚本
2    cat > /usr/local/bin/renew_ssl.sh << EOF
3    #!/bin/bash
4    certbot renew --dns-cloudflare --dns-cloudflare-credentials /root/cloudflare.ini --deploy-hook "systemctl reloadNginx"
5    # 同步证书到所有子站
6    for subdomain in product1 product2 api; do
7        rsync -av /etc/letsencrypt/live/example.com/* user@$subdomain.example.com:/etc/nginx/ssl/
8        ssh user@$subdomain.example.com "nginx-s reload"
9    done
10  EOF
11
12  # 添加执行权限
13  chmod +x /usr/local/bin/renew_ssl.sh(3)设置定时任务:
1    # 每月1日自动执行续期
2    crontab -e
3    0 0 1 * * /usr/local/bin/renew_ssl.sh >> /var/log/ssl_renew.log 2>&1对所有子站执行以下验证步骤,确保证书正确生效:
(1)基础HTTPS访问测试:
1    for subdomain in product1 product2 api; do
2        curl -I https://$subdomain.example.com
3    done(2)证书信息一致性验证:
1    # 示例:查看product1.example.com的证书信息
2    openssl s_client -connect product1.example.com:443 2>/dev/null | openssl x509 -noout -issuer -dates(3)浏览器端验证:
使用在线工具对所有子站进行SSL安全评分,推荐工具及检测重点:
(1)SSL Labs Server Test:
1)支持不安全的协议(如 TLS 1.0)或加密套件(如 RC4)。
2)证书链不完整(未配置中间证书)。
3)存在Heartbleed、POODLE等漏洞。
(2)批量扫描工具:
1    # 下载testssl.sh
2    wget https://github.com/drwetter/testssl.sh/raw/master/testssl.sh
3    chmod +x testssl.sh
4
5    # 批量检测
6    for subdomain in product1 product2 api; do
7        ./testssl.sh https://$subdomain.example.com > $subdomain_ssl_report.txt
8    done随着子站数量的增长,统一SSL证书的管理优势会更加明显。企业可结合自身域名架构,选择最适合的证书类型,并建立 “申请 - 部署 - 续期 - 检测” 的全流程管理机制,为用户提供安全、可信的访问体验。
Dogssl.cn拥有20年网络安全服务经验,提供构涵盖国际CA机构Sectigo、Digicert、GeoTrust、GlobalSign,以及国内CA机构CFCA、沃通、vTrus、上海CA等数十个SSL证书品牌。全程技术支持及免费部署服务,如您有SSL证书需求,欢迎联系!