在Windows下配置Apache + OpenSSL

从网上寻了很多类似的文章,独该文条理清晰,简洁明快,故收之,望惠人惠己
原文地址:http://www.zhangdi.name/2008/02/19/apache-ssl-under-windows.html

1. 下载包含OpenSSL的Apache Http Server。目前的最新版是apache_2.2.8-win32-x86-openssl-0.9.8g.msi

2. 安装Apache。最好装在磁盘的根目录下,例如:C:/Apache2.2/。安装时必须制定一个域名,如果只是本机测试,可以在hosts文件中随便加入一个域名指向本机IP就可以了。

3. 打开文件:%安装目录%/conf/httpd.conf,将下面两行的注释去掉:

 LoadModule ssl_module modules/mod_ssl.so
 Include conf/extra/httpd-ssl.conf

4. 在Console中切换到目录:%安装目录%/bin。运行下面三行命令:(在执行第一个命令时,会被问很多问题,最重要的是Common Name项的值要和你的网站域名相同。例如test.com,www.test.com之类的。)

openssl req -new -out server.csr -config ../conf/openssl.cnf
openssl rsa -in privkey.pem -out server.key
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650

5. 完成之后,将目录中的server.key和server.crt拷贝到%安装目录%/conf目录中。

6. 重启Apache Http Server服务。

7. 访问https://test.com。(假设安装时使用此域名。)

如果Apache服务启动失败,尝试运行%安装目录%/bin/httpd.exe,可以看到错误信息,对于修正错误会很有帮助。

猜你喜欢

转载自blog.csdn.net/weixin_38893715/article/details/72780015