Windows平台下Apache的SSL配置過程

來源:互聯網
上載者:User
首先需要下載並安裝Apache。

下面是下載頁面:

http://apache.mirrors.tds.net/httpd/binaries/win32/apache_2.2.4-win32-x86-openssl-0.9.8d.msi

由於我們需要啟動SSL,所以請下載這個已經將openssl打包的版本。

安裝以後,需要配置SSL。

開啟conf/httpd.conf檔案

目錄為:C:\Program Files\Apache Software Foundation\Apache2.2\conf

將下面兩行前面的#號去掉:

LoadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

修改httpd-ssl.conf

這個檔案主要是配置項的路徑名沒有加上引號,所以有問題。
尋找所有具有檔案路徑的配置加上""。

到這一步,剩下的就是如何產生SSL配置所需要的兩個檔案了:
server.crt
server.key

首先需要下載openssl,或者使用apache打包在bin目錄下的openssl。

http://209.61.202.80/apache/Openssl-0.9.8d-Win32.zip

然後需要下載一個設定檔:

http://www.securityfocus.com/data/tools/openssl.conf

將openssl壓縮包中的檔案全部解到c:\program files\OpenSSL目錄下
將openssl.conf也放到這個目錄中

運行cmd.exe
切換到c:\program files\openssl目錄
首先需要建立認證簽章要求和私密金鑰檔案:

openssl req -new -out server.csr

openssl req -new -out server.csr -config openssl.conf

它會問一系列的問題,要注意的是commonName要輸入和你的網站網域名稱一樣:比如www.yourdomain.com
然後RSA簽名:

openssl rsa -in privkey.pem -out server.key

最後建立自簽認證:

openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650

完成之後,將產生的server.crt和server.key這兩個檔案拷貝到apache的conf目錄下。

現在使用https://www.yourdomain.com,應該就可以看到It works了。

參見:

http://www.openphp.cn/index.php/article/7/121/index.html

http://hunter.campbus.com/

http://www.nsfocus.net/index.php?act=magazine&do=view&mid=1796

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.