為web站點提供https服務的步驟
阿新 • • 發佈:2018-04-28
https服務的提供https實現:httpd利用https協議通過證書安全加密,使得資源進行加密傳輸 //SSL會話是基於IP地址所構建的,所以單IP地址的服務器,僅可以創建一個基於https的虛擬主機
創建私有CA:OpenSSL 1.創建CA的私鑰: ~]# (umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048) 2.生成CA的自簽證書: ~]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem -days 3653 3.完善CA所必需目錄級文件要求和文本文件級文件要求: ~]# touch /etc/pki/CA/index.txt ~]# echo 01 > /etc/pki/CA/serial 創建https站點: 1.為httpd服務器生成密鑰並生成證書請求: ~]# mkdir /etc/httpd/ssl ~]# cd /etc/httpd/ssl ~]# (umask 077;openssl genrsa -out httpd.key 2048) ~]# openssl req -new -key httpd.key -out httpd.csr -days 3653 2.將證書請求發送到CA: ~]# scp httpd.csr CA_SERVER:/tmp 3.在CA上為此次請求簽發證書: ~]# openssl ca -in /tmp/httpd.csr -out /etc/pki/CA/certs/httpd.crt -days 3653 4.在CA上將CA簽發的證書傳送到httpd服務器: ~]# scp /etc/pki/CA/certs/httpd.crt HTTP_SERVER:/etc/httpd/ssl 5.在httpd服務器上,刪除證書請求文件: ~]# rm -f httpd.csr 6.在httpd服務器上配置ssl支持: 1) 保證mod_ssl模塊被正確裝載;如果沒有,則需要單獨安裝; yum -y install mod_ssl /etc/httpd/conf.d/ssl.conf /usr/lib64/httpd/modules/mod_ssl.so 2) 配置https的虛擬主機: <VirtualHost 172.16.88.99:443> DocumentRoot "/myvhost/https" ServerName www.a.com SSLCertificateFile /etc/httpd/ssl/httpd.crt SSLCertificateKeyFile /etc/httpd/ssl/httpd.key </VirtualHost>
為web站點提供https服務的步驟