windows下安裝apache並配置ssl

來源:互聯網
上載者:User

   步驟1:配置 APACHE以支援SSL

  找到下面兩行去掉前面的注釋 #

  LoadModule ssl_module modules/mod_ssl.so

  Include conf/extra/httpd-ssl.conf

  步驟2: 為網站伺服器產生認證及私密金鑰檔案

  C:Program FilesApache Software FoundationApache2.2bin>openssl genrsa -out server.key 1024

  產生一個server.key

  步驟3:產生簽署申請

  C:Program FilesApache Software FoundationApache2.2bin>openssl req -new -out server.csr -key server.key -config ..confopenssl.cnf

  此時產生簽署檔案 SERVER.CSR

  步驟4:使用OPENSSL產生CA私密金鑰

  C:Program FilesApache Software FoundationApache2.2bin>openssl genrsa -out ca.key 1024

  多出CA.key檔案

  步驟5:利用CA的私密金鑰產生CA的自簽署認證

  C:Program FilesApache Software FoundationApache2.2bin>openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ..confopenssl.cnf

  步驟6:在bin目錄下建立demoCA目錄,在demoCA下建立index.txt,newcerts,serial 目錄結構如下

  demoCA

  |--index.txt(文本,內容為空白)

  |--newcerts(檔案夾)

  |--serial(文本,內容為 01)

  步驟7:準備為網站伺服器簽署認證

  C:Program FilesApache Software FoundationApache2.2bin>openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ..confopenssl.cnf

  產生 server.crt檔案

  步驟8:將 server.crt server.key複製到 conf檔案夾下

  ------------------配置ssl常見問題---------------------

  win7系統64位在配置過程中,在重啟apache時可能會出現問題

  問題1:apache重啟失敗,報錯資訊Syntax error on line 62 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/extra/httpd-ssl.conf:

  SSLSessionCache: Invalid argument: size has to be >= 8192 bytes

  解決辦法:

  將confextrahttpd-ssl.conf中61-63行修改成下面這樣即可SSLSessionCache "dbm:C:/Program Files (x86)/Apache Software Foundation/Apache2.2/logs/ssl_scache"

  # SSLSessionCache "shmcb:C:/Program Files (x86)/Apache Software Foundation/Apache2.2/logs/ssl_scache(512000)"

  SSLSessionCacheTimeout 300

相關文章

聯繫我們

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