安装环境:Wampserver集成安装包;window7 x64系统。
openssl.exe 所在位置 E:\wamp\bin\apache\apache2.4.9\bin
1.打开cmd,进入openssl.exe所在位置
cd E:\wamp\bin\apache\apache2.4.9\bin
2.设置配置文件
set OPENSSL_CONF=../conf/openssl.cnf
3.生成需要的私钥
openssl genrsa > root.key // 生成根密钥
openssl genrsa > server.key // 生成服务端密钥
openssl genrsa > client.key // 生成客户端密钥
4.生成自签名的根证书
openssl req -x509 -new -key root.key > root.crt
openssl req -new -key server.key -out server.csr
openssl req -new -key client.key -out client.csr
Country Name (2 letter code) [AU]:CNISO国家代码(只支持两位字符)
State or Province Name (full name) [Some-State]:ZJ所在省份
Locality Name (eg, city) []:HZ所在城市
Organization Name (eg, company):THS公司名称
Organizational Unit Name (eg, section) []:THS组织名称
Common Name (eg, YOUR name) []:localhost(申请证书的域名或IP地址)
Email Address []:laoniangke@xxx.com管理员邮箱
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:交换密钥
An optional company name []:
5.配置openssl.cnf
md demoCA
md demoCA\newcerts
md demoCA\private
cd. > demoCA\index.txt
echo 01 > demoCA\serial
echo 01 > demoCA\crlnumber
openssl genrsa -out demoCA/private/cakey.pem 2048
openssl req -out demoCA/cacert.pem -x509 -new -key demoCA/private/cakey.pem
6.使用根证书为服务端及客户端签名
openssl ca -in server.csr -cert root.crt -keyfile root.key -out server.crt
openssl ca -in client.csr -cert root.crt -keyfile root.key -out client.crt
7.将客户端证书转成pfx格式,并在浏览器上导入该证书
openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx
8.配置http.conf,所在位置E:\wamp\bin\apache\apache2.4.9\conf\http.conf,反注释(只列出修改部分)
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule sslmodule modules/modssl.so
Include conf/extra/httpd-ssl.conf
9.配置http-ssl.conf,所在位置E:\wamp\bin\apache\apache2.4.9\conf\extra\http-ssl.conf(只列出修改部分)
SSLSessionCache "shmcb:E:/wamp/logs/ssl_scache"
Mutex default
<VirtualHost _default_:443>
DocumentRoot "E:/wamp/www"
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "E:/wamp/logs/apache_error.log"
TransferLog "E:/wamp/logs/access.log"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "E:/wamp/bin/apache/apache2.4.9/bin/server.crt"
SSLCertificateKeyFile "E:/wamp/bin/apache/apache2.4.9/bin/server.key"
SSLCACertificateFile "E:/wamp/bin/apache/apache2.4.9/bin/root.crt"
SSLVerifyClient require
SSLVerifyDepth 10
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars +ExportCertData
</FilesMatch>
CustomLog "E:/wamp/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
重启 wampserver,如有问题,查看E:\wamp\logs\apache_error.log
如果发现apache 重启不了
后面有问题就到apache的/bin/httpd.exe -t 来看错误
也要看一下是否有程序占用443端口
I've also enabled "LoadModule status_module modules/mod_status.so" using the following configuration in httpd.conf:
<IfModule status_module>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>
</IfModule>
You can check now your server status here
https://localhost/server-status/
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com