標籤:apache https 443
apache 要支援https 必須要有mod_ssl軟體
[[email protected] www]# yum install mod_ssl
[[email protected] ~]# /etc/init.d/httpd restart
修改防火牆添加443
Centos 6.x 已經提供了預設的ssl機制所需私密金鑰與憑證檔案
* /etc/httpd/conf.d/ssl.conf mod_ssl提供的 Apache 設定檔案;
* /etc/pki/tls/private/localhost.key 系統私密金鑰檔案,可以用來製作憑證的!
* /etc/pki/tls/certs/localhost.crt 就是加密過的憑證檔案!(signed certificate)
添加了https 同一個頁面http https都可訪問 其實沒什麼意義 要把https和http的頁面分離開
可以採用apache的虛擬機器機制進行分離
[[email protected] ~]# mkdir /var/www/https
[[email protected] ~]# echo "This is https‘ home" > /var/www/https/index.html
修改 ssl.conf 的內容
[[email protected] ~]# vim /etc/httpd/conf.d/ssl.conf
Listen 443 <==預設的監聽連接埠!不建議修改!
<VirtualHost _default_:443> <==就是虛擬機器主機的設定!
DocumentRoot "/var/www/https" <==大概84行,拿掉注釋更改目錄名稱
ServerName *:443 <==拿掉注釋,並將主機名稱設定為 *
SSLEngine on <==支援 SSL 的意思!
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/vbird.crt
SSLCertificateKeyFile /etc/pki/tls/certs/vbird.key
</VirtualHost>
[[email protected] ~]# /etc/init.d/httpd restart
Apache開啟https