目前“宝塔SSL”自动申请绑定一个证书,即根域名和www域名,如果还需要绑定手机端m则需要绑定多个域名
如果多域名绑定一个网站数据,需要新建多个站点指向同一文件目录。
用相同的方法,在不新建站点的前提下,手动修改“站点配置文件”;
经测试可以多域名证书,缺点是不能再次通过宝塔编辑站点配置,否则会覆盖文件
方法如下,先申请多个站点证书,然后在宝塔网站“www.bt.cn”右上角登录会员账号,下载证书,复制压缩包的Nginx证书,上传到/www/server/panel/vhost/cert/站点域名,目录(多个域名都上传)
打开站点的“站点配置”复制黏贴一份相同的内容,然后对黏贴的内容修改域名,替换新域名证书(第一行是bundle.pem,第二行是.key)
注意:检测上面多个站点配置的域名不能有重复,为安全期间,修改前,先备份一下原先配置
然后保存配置,重启Nginx
server
{
listen 80;
listen 443 ssl http2;
server_name 123.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/123_cn;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/123.cn/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/123.cn/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-53.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/123.cn.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.project|LICENSE|README.md)
{
return 404;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
access_log /www/wwwlogs/123.cn.log;
}
server
{
listen 80;
listen 443 ssl http2;
server_name s.123.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/123_cn;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/123.cn/1_s.123.cn_bundle.pem;
ssl_certificate_key /www/server/panel/vhost/cert/123.cn/0_s.123.cn.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-53.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/123.cn.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.project|LICENSE|README.md)
{
return 404;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
access_log /www/wwwlogs/123.cn.log;
}
SSL里面两个文件的含义
fullchain.pem 是证书和根证书(上面放证书,下面放根证书)
privkey.pem 即是证书秘钥
参考网站:https://www.bt.cn/bbs/thread-8470-1-1.html?btwaf=80843689