1 .声明
我的wampserver 路径 是 C:\wamp
wampserver 的版本是 WampServer Version 2.5
Apach 的版本是 2.4.9
操作系统是 win10;
本机局域网id 192.168.31.108
步骤
1. 把 C:\wamp\bin\apache\apache2.4.9\bin
的 ssleay32.dll,libeay32.dll ,openssl.exe三个文件复制到 C:\Windows\System32这个目录下。
2. 生成服务器证书
打开cmd 命令行 输入
跳转到 cd C:\wamp\bin\apache\apache2.4.9\bin 回车
输入
openssl req -new -out server.csr -config ../conf/openssl.cnf
按回车键
输入 whatisjava
按回车键
输入 whatisjava
按回车键
输入 CN
按回车键
输入CHONGQING
按回车键
输入CHONGQING
按回车键
输入CHONGQING
按回车键
输入CHONGQING
按回车键
输入你的域名 或者服务器ip 我的是本地测试 输入我服务器ip
按回车键
输入你的邮箱
按回车键
输入whatisjava
按回车键
二次输入whatisjava
如图
这时候 C:\wamp\bin\apache\apache2.4.9\bin 生成了2个文件
privkey.pem ,server.csr 2个文件。
然后 在C:/wamp/bin/apache/apache2.4.9/ 下面创建一个ssh 文件夹 并生成的2个文件拷贝进去
生成私匙
输入 openssl rsa -in privkey.pem -out server.key
按回车
输入whatisjava
按回车键
没报错 恭喜你就成功了
创建证书 server.crt
输入
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
按回车
出现ok 就成功了
在 C:\wamp\bin\apache\apache2.4.9\bin 目录下 找到
刚刚生成 server.key 和 server.csr 并复制到 刚刚建立的那个ssh 文件夹里面 也就是C:\wamp\bin\apache\apache2.4.9\ssh 这个目录下面
此时的目录机构
证书生成好了 下一步就是 修改配置文件了
Step2**** -> Copy the server.key and server.crt files.
2a) In the conf folder of apache2.2.8 folder, create two folders named as ssl.key and ssl.crt
2b) copy the server.key file to ssl.key folder and server.crt file to ssl.crt
*Step3*** -> Edit the httpd.conf file and php.ini
3a) In httpd.conf file, remove the comment ‘#’ at the line which says: LoadModule ssl_module
modules/mod_ssl.so
3b) In httpd.conf, remove the comment ‘#’ at the line which says: Include
conf/extra/httpd_ssl.conf
Then move that line after this block ….
3c) open the php.ini file located in apache2.2….\bin folder, remove the comment ‘;’ at the line
which says: extension=php_openssl.dll
*Step4** -> Edit the httpd_ssl.conf file in the folder name, extra
4a) Find the line which says “SSLMutex ….” and change it to “SSLMutex default” without quotes
4b) Find the line which says: . Right after it, change the line which says “DocumentRoot …” to DocumentRoot “C:/wamp/www/” with quotes. Change the line “ErrorLog….” to Errorlog logs/sslerror_log. Change the line “TransferLog ….” to TransferLog logs/sslaccess_log
4c) SSL crt file: Change the line “SSLCertificateFile ….” to SSLCertificateFile “conf/ssl.crt/server.crt”
4d) SSL key file: Change the line “SSLCertificateKeyFile ….” to SSLCertificateKeyFile “conf/ssl.key/server.key”
4e) Change the line which says