服務(wù)器
服務(wù)器上有兩個(gè)項(xiàng)目,都要配置https,所以在阿里云申請(qǐng)了兩個(gè)二級(jí)的免費(fèi)證書。
博主用的是phpstudy,如果用的其他集成環(huán)境,其實(shí)也差不多,參考下改改就好了。
一.申請(qǐng)證書(這里我用的是阿里的域名)
1.登錄阿里云,點(diǎn)擊域名,找到要配置ssl的域名,點(diǎn)擊后面的ssl證書
2.這里我申請(qǐng)的是免費(fèi)的單域名證書,點(diǎn)擊確定提交阿里云審核,大概10-20分鐘左右就審核好了
3.點(diǎn)擊左邊的菜單,選擇要配置的域名相應(yīng)的證書,點(diǎn)擊后面的下載
4.我的環(huán)境是apache,這里我下載的是apache。
二、配置ssl
1.服務(wù)器上配置站點(diǎn)
2.修改http.conf
(1)去掉 loadmodule ssl_module modules/mod_ssl.so 前的#號(hào)
(2)找到#include conf/extra/httpd-ssl.conf這句話,這里我們就不用自帶的文件了,我是新建了個(gè)文件
(3)新建這個(gè)文件
(4)新建cert文件夾,將剛剛下載的證書文件(4個(gè))放到這個(gè)文件里
如果你要配置兩個(gè)ssl,那再建一個(gè)文件夾放另一個(gè)證書的文件
這里分別我建了api和certlzf兩個(gè)文件夾
(5)編輯vhosts-ssl.conf文件
到這里,重啟apache,輸入剛剛配置過得域名就完成了~
下面附上vhost-ssl.conf的代碼
listen 443<virtualhost *:443> documentroot 這里改為你項(xiàng)目的絕對(duì)路徑 servername 這里改為你要配置的域名 serveralias 這里改為你要配置的域名 sslengine on sslprotocol tlsv1 tlsv1.1 tlsv1.2 sslciphersuite high:medium:!anull:!md5 sslcertificatefile 這里改為你公鑰的絕對(duì)路徑 sslcertificatekeyfile 這里改為你私鑰的絕對(duì)路徑 sslcertificatechainfile 這里改為你證書鏈的絕對(duì)路徑 <directory 這里改為你項(xiàng)目的絕對(duì)路徑> options followsymlinks execcgi allowoverride all order allow,deny allow from all require all granted </directory></virtualhost><virtualhost *:443> documentroot 這里改為你項(xiàng)目的絕對(duì)路徑 servername 這里改為你要配置的域名 serveralias 這里改為你要配置的域名 sslengine on sslprotocol tlsv1 tlsv1.1 tlsv1.2 sslciphersuite high:medium:!anull:!md5 sslcertificatefile 這里改為你公鑰的絕對(duì)路徑 sslcertificatekeyfile 這里改為你私鑰的絕對(duì)路徑 sslcertificatechainfile 這里改為你證書鏈的絕對(duì)路徑 <directory 這里改為你項(xiàng)目的絕對(duì)路徑> options followsymlinks execcgi allowoverride all order allow,deny allow from all require all granted </directory></virtualhost>總結(jié)
以上所述是小編給大家介紹的apache環(huán)境下配置多個(gè)ssl證書搭建多個(gè)站點(diǎn)的方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)西部數(shù)碼網(wǎng)站的支持!