Windows下apache 實現 SSL

來源:互聯網
上載者:User

文章參考 http://dufei.blog.51cto.com/382644/90532/


假設已安裝成功wamp, 筆者使用的是phpstudy套件,apache安裝位置為C:\Program Files\phpStudy\Apache2;以此說明

1 首先下載 openssl-0.9.8g for windows

2 解壓,並copy至 C:\Program Files\phpStudy\openssl-0.9.8g_win32

3 命令列模式,cd至C:\Program Files\phpStudy\openssl-0.9.8g_win32\bin

4 產生伺服器的私密金鑰

>openssl genrsa -out server.key 1024

目前的目錄下會產生server.key檔案

5

產生簽署檔案  >openssl req -new -out server.csr -key server.key -config ..\..\apache2\conf\openssl.cnf
openssl.cnf檔案路徑會依安裝位置不同而不同
產生過程中要輸入配置資訊,不可留空,否則CA認證無法產生
目前的目錄下會產生server.csr檔案
6

產生CA私密金鑰>openssl genrsa  -out ca.key 1024
目前的目錄下會產生ca.key檔案
7

在openssl\bin目錄下建立demoCA目錄包含以下檔案和目錄
檔案:index.txt(內容為空白)
檔案:serial(內容為01)
目錄:newcerts
8

利用CA的私密金鑰產生CA的自簽署認證

>openssl req  -new -x509 -days 365 -key ca.key -out ca.crt  -config ..\..\apache2\conf\openssl.cnf
openssl.cnf檔案路徑會依安裝位置不同而不同
目前的目錄下會產生ca.crt檔案
9 將 server.crt, server.key複製到apache的conf目錄下
10 配置 APACHE以支援SSL

      LoadModule ssl_module modules/mod_ssl.so      Include conf/extra/httpd-ssl.conf     去掉兩行前面的#

11 依apache實際安裝位置修改conf/extra/httpd-ssl.conf檔案內的路徑資訊,
12 重啟apache

相關文章

聯繫我們

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