apache 配置 ssl https

轉載自http://wyllife.blog.163.com/blog/static/4116390120141130111926688/ apache

配置https協議:windows

一、安裝好apache環境,注意要裝ssl版本的。這裏裝在c:/apache目錄下。服務器

二、生成服務器證書命令行

1)在DOS命令下進入apache/bin目錄調試

2)在windows環境下需先設置Openssl環境變量:
執行命令 (set OPENSSL_CONF=..\conf\openssl.cnf)server

3)生成私鑰文件:openssl genrsa 1024>server.key blog

4)生成證書請求文件:ssl

openssl req -new -key server.key > server.csr  或openssl

openssl req -new -key server.key -out server.csr -config ..\conf\openssl.cnf 變量

而後按提示輸入一些數據,其中Common Name和下文的/httpd-ssl.conf  中servername必須一致

5)簽署服務器證書文件。

openssl req -x509 -days 365 -key server.key -in server.csr > server.crt  

6)配置apache的httpd.conf文件, 取消註釋

  1. Include conf/extra/httpd-ssl.conf  
  2. LoadModule ssl_module modules/mod_ssl.so 
  3. LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

7)打開httpd-ssl.conf,修改以下

  1. <VirtualHost _default_:443>  
  2. SSLEngine On  
  3. SSLCertificateFile ../bin/server.crt   
  4. SSLCertificateKeyFile ../bin/server.key  
  5. #SSLCertificateChainFile ../bin//ca.crt // 暫未啓用  
  6. #......   
  7. DocumentRoot "c:/apache/htdocs"  
  8. ServerName www.kedou.com:443  
  9. </VirtualHost>  8)
  10. apache 調試,啓動

    進入命令行Apache\bin目錄下

    執行 httpd.exe -X

相關文章
相關標籤/搜索