首页 » Web前端 » apche开启php技巧_phpStudy集成情形apche下openssl来设备本地https做事器

apche开启php技巧_phpStudy集成情形apche下openssl来设备本地https做事器

访客 2024-12-05 0

扫一扫用手机浏览

文章目录 [+]

1-1:在httpd.conf中,删掉以下语句前的’#’

#LoadModule ssl_module modules/mod_ssl.so

apche开启php技巧_phpStudy集成情形apche下openssl来设备本地https做事器

#Include conf/extra/httpd-mpm.conf

apche开启php技巧_phpStudy集成情形apche下openssl来设备本地https做事器
(图片来自网络侵删)

#Include conf/extra/httpd-ssl.conf

1-2:httpd-ssl.conf中把相应选项改成如下,有’#’的删掉

ServerName www.qrcodelocal.com:443 (你想设置的访问域名,自定义)

SSLCertificateFile \"大众/Apache24/conf/server.crt\公众

SSLCertificateKeyFile \公众/Apache24/conf/server.key\公众

SSLCACertificateFile \公众/Apache24/conf/ca.crt\"大众

SSLVerifyClient require

SSLVerifyDepth 1

2:在phpStudy安装目录的根目录中(例如我的phpstudy安装在D盘,就在D盘中新建)新建Apache24文件夹,并在里面新建cgi-bin、conf、htdocs、logs四个文件夹,在htdocs里面新建index.html,用来一下子测试,conf文件夹存放我们天生的证书。

3:天生各种证书

3-1:把Apache\conf文件夹下的openssl.cnf文件复制到Apache24\conf文件夹中,如图:

3-2:在Apache24\conf文件夹中按住shift+鼠标右键打开命令窗口

首先要天生做事器真个私钥(key文件):

set OPENSSL_CONF=openssl.cnf

openssl genrsa -des3 -out server.key 1024

这是须要输入一个server.key,我这里输入的都是1234

3-3:天生server.csr ,Certificate Signing Request(CSR),天生的csr文件交给CA署名后形成做事端自己的证书.屏幕年夜将有提示,依照其指示一步一步输入哀求的个人信息即可

openssl req -new -key server.key -out server.csr -config openssl.cnf

server.key为上面设置的1234,下面还有设置key的地方,为了避免记错,我傻瓜式的都设置成了1234

Commen Name:为httpd-ssl.conf 》 ServerName 中填写的域名,去掉www

3-4:对客户端也作同样的命令天生key及csr文件,输入信息一样即可

openssl genrsa -des3 -out client.key 1024

openssl req -new -key client.key -out client.csr -config openssl.cnf

3-5:CSR文件必须有CA的署名才可形成证书.可将此文件发送到verisign等地方由它验证,要交一大笔钱,何不自己做CA呢

openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cnf

3-6:新建demoCA文件夹,进入,新建newcerts文件夹;新建index.txt;新建serial文件,打开后输入01保存即可。
如图:

3-7:用天生的CA的证书为刚才天生的server.csr,client.csr文件署名

openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cnf

openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf

3-8:openssl pkcs12 -export -in ca.crt -inkey ca.key -out ca.pfx

天生一个ca.pfx,打开IE浏览器-》工具-》Internet选项-》内容-》证书,按照提示导入,这里要输入刚才天生 .pfx 过程中输入的密码

3-9:在httpd.conf中找到下面这句话 #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 取消注释(删掉前面的\"大众#\公众)

3-10:openssl rsa -in server.key -out server.key 天生的server.key

然后打开httpd-ssl.conf 找到SSLPassPhraseDialog builtin 在前面加上#

3-11:在系统盘C:\Windows\System32\drivers\etc\hosts 文件中添加 127.0.0.1 想本地访问的域名例如www.qrcodelocal.com 保存关闭,重启Apache,浏览器访问https://www.qrcodelocal.com该当就可以访问了。

注:有时相同域名重新天生client.csr时会提醒there is already a certificate已经有一个证书了。
那就把当前证书撤销:openssl ca -keyfile ca.key -cert ca.crt -revoke .\demoCA\newcerts\01.pem(预测.pem文件该当保持序号最大的最新的),然后再重新运行即可

标签:

相关文章

php快手付出技巧_支付营销系统

常见的营销办法有多种,包括做事营销、体验营销、知识营销、情绪营销、教诲营销、差异化营销、直销、网络营销等。在第三方支付企业中,营销...

Web前端 2024-12-07 阅读0 评论0