赞
踩
1.先申请多个站点证书,然后在宝塔网站右上角登录会员账号,下载证书,复制压缩包的Nginx证书,上传到/etc/letsencrypt/live/站点域名目录(多个域名都上传);
2.打开站点的“站点配置”复制黏贴一份相同的内容,然后对黏贴的内容修改域名,替换新域名证书(第一行是bundle.pem,第二行是.key);
注意:检测上面多个站点配置的域名不能有重复,为安全期间,修改前,先备份一下原先的配置。
3.然后保存配置,重启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 /etc/letsencrypt/live/123.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/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 /etc/letsencrypt/live/123.cn/1_s.123.cn_bundle.pem;
ssl_certificate_key /etc/letsencrypt/live/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;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。