Apache開啟https

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.