apache配置https步驟

來源:互聯網
上載者:User

標籤:style   http   color   io   ar   for   strong   sp   檔案   

配置過程如下:
步驟一:安裝apache,使其支援SSL,並安裝php
1.安裝配有SSL模組的apache,apache_2.2.8-win32-x86-openssl-0.9.8g
2.配置apache以支援SSL:開啟apache的設定檔conf/httpd.conf
1)LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
去掉兩行前面的#
2)注意修改httpd-ssl.conf 檔案裡的兩個欄位:
SSLCertificateFile "C:/Apache2.2/conf/server.crt"
SSLCertificateKeyFile "C:/Apache2.2/conf/server.key"
為下面你所產生的認證和密鑰地址。

61行:

          SSLSessionCache  "dbm:D:/Program/Apache Software/Apache2.2.17/logs/ssl_scache"

       62行:

  #SSLSessionCache   "shmcb:D:/Program/Apache Software/Apache2.2.17/logs/ssl_scache(512000)"

       將61行的SSLSessionCache前#號去掉,將62行的SSLSessionCache前面加上#號,

       (否則啟動 apache 時就會出錯誤:Syntax error on line 62 of D:/Program Files/..../conf/httpd-  ssl.conf:SSLSessionCache:Invalid argument:size has to be >= 8192 bytes)

步驟二:為網站伺服器產生認證及私密金鑰檔案
1. 產生伺服器的私密金鑰
進入命令列:
D:\local\apache2\bin\openssl genrsa -out server.key 1024
在目前的目錄下產生了一個server.key產生簽署申請
2. 產生簽署申請
D:\local\apache2\bin>openssl req -new –out server.csr -key server.key -config ..\conf\openssl.cnf
此時產生簽署檔案server.csr.

步驟三:通過CA為網站伺服器簽署認證

1.產生CA私密金鑰
D:\local\apache2\bin\openssl genrsa -out ca.key 1024
多出ca.key檔案
2.利用CA的私密金鑰產生CA的自簽署認證
D:\local\apache2\bin\openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ..\conf\openssl.cnf
此時需要輸入一些資訊,注意Common Name為伺服器網域名稱,如果在本機,為本機IP。
3.CA為網站伺服器簽署認證
D:\local\apache2\bin\openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ..\conf\openssl.cnf
但,此時會報錯:
於是在在目前的目錄建立demoCA,裡面建立以下檔案,index.txt,serial:serial內容為01,其他為空白,以及檔案夾 newcert.再執行一遍,即可產生server.crt檔案

步驟四:然後將 server.crt,server.key複製到apache的conf檔案夾下,重啟apache

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.