宝塔面板一个网站绑定两个域名配置SSL
宝塔面板一个网站绑定两个以上的域名配置SSL
1、比如a.com b.com c.com 同时绑定一个网站
2、申请证书,获取pem、key
3、开启a.com 的ssl
4、点击左侧配置文件
-
<VirtualHost *:80>
-
ServerAdmin webmaster@example.com
-
DocumentRoot "/www/wwwroot/test.com/public"
-
ServerName 7277db5a.test.com
-
ServerAlias a.com b.com c.com
-
#errorDocument 404 /404.html
-
ErrorLog "/www/wwwlogs/test.com-error_log"
-
CustomLog "/www/wwwlogs/test.com-access_log" combined
-
-
#DENY FILES
-
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
-
Order allow,deny
-
Deny from all
-
</Files>
-
-
#PHP
-
<FilesMatch \.php$>
-
SetHandler "proxy:unix:/tmp/php-cgi-74.sock|fcgi://localhost"
-
</FilesMatch>
-
-
#PATH
-
<Directory "/www/wwwroot/test.com/public">
-
SetOutputFilter DEFLATE
-
Options FollowSymLinks
-
AllowOverride All
-
Require all granted
-
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
-
</Directory>
-
</VirtualHost>
-
<VirtualHost *:443>
-
ServerAdmin webmasterexample.com
-
DocumentRoot "/www/wwwroot/test.com/public"
-
ServerName SSL.abc.com
-
ServerAlias a.com
-
#errorDocument 404 /404.html
-
ErrorLog "/www/wwwlogs/test.com-error_log"
-
CustomLog "/www/wwwlogs/test.com-access_log" combined
-
-
#SSL
-
SSLEngine On
-
SSLCertificateFile /www/server/panel/vhost/cert/a.com/fullchain.pem
-
SSLCertificateKeyFile /www/server/panel/vhost/cert/a.com/privkey.pem
-
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
-
SSLProtocol All -SSLv2 -SSLv3 -TLSv1
-
SSLHonorCipherOrder On
-
-
#PHP
-
<FilesMatch \.php$>
-
SetHandler "proxy:unix:/tmp/php-cgi-74.sock|fcgi://localhost"
-
</FilesMatch>
-
-
-
#DENY FILES
-
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
-
Order allow,deny
-
Deny from all
-
</Files>
-
-
#PATH
-
<Directory "/www/wwwroot/test.com/public">
-
SetOutputFilter DEFLATE
-
Options FollowSymLinks
-
AllowOverride All
-
Require all granted
-
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
-
</Directory>
-
</VirtualHost>
5、可以看到<VirtualHost *:443>标签内只配置了a.com的ssl证书。复制此标签内容,配置 b.com 和 c.com (其他部分省略) 需要改变的就三行
-
<VirtualHost *:443>
-
...
-
ServerAlias a.com
-
...
-
SSLCertificateFile /www/server/panel/vhost/cert/a.com/fullchain.pem
-
SSLCertificateKeyFile /www/server/panel/vhost/cert/a.com/privkey.pem
-
...
-
</VirtualHost>
把B、C相应的证书放到 /www/server/panel/vhost/cert/*****.com/fullchain.pem 、 /www/server/panel/vhost/cert/*****.com/privkey.pem
点击保存。
注:配置好后就可以正常访问 htttps://a.com htttps://b.com htttps://c.com
不要再点击ssl里面的部署按钮,否则会覆盖你刚编辑保存的配置文件。
因此最好把配置文件的内容复制下来保存一份,防止以后误操作覆盖
阅读剩余
THE END