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

相关文章
相关标签/搜索