配置阿里免费ssl

配置ssl(阿里版)
1.同样规则,去阿里申请免费证书去
注:环境(wamp) phpstudy->7.0.12
阿里免费证书下载(免费版不是很好找)

按照阿里流程操作即可,在这就不一步步赘述了!

开启服务器443端口(https默认端口)

阿里云控制台=》云计算基础服务=》云服务器ECS=》网络和安全=》安全组,没有安全组的创建一个安全组,有的直接选择相应安全组,点击配置规则=》添加安全组规则(把80端口和443端口添加进安全组,授权对象填0.0.0.0/0

将下载的证书文件放置于 apache/conf/cert下(cert 为自己创建文件)

2.配置apache
修改httpd.conf文件
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
LoadModule rewrite_module
Incule conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-ssl.conf
去掉面前的"#"
修改httpd-vhosts.conf (最下方添加)
:80>
DocumentRoot “网站目录”
ServerName www.demo.com
ServerAlias m.demo.com
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted


进入httpd-ssl.conf
大约60行修改
:443>
DocumentRoot “网站目录”
ServerName 网站域名
ErrorLog “logs/ssl_error.log”
TransferLog “logs/ssl_access.log”
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3 (这个为添加)
#修改验证文件(80行大约)
SSLCipherSuite HIGH:!RC$:!MD5:!aNULL:!eNUll:!NULL:!DH:!END:!EXP:+MEDIUM
SSLHonorCipherOrder on
#找到引入证书文件配置行
SSLCertificateFile "conf/ssl/163**_www.demo.com_public_crt"
SSLCertificateKeyFile “conf/ssl/163***_www.demo.com.key”
SSLCertificateChainFile “conf/cert/163**_www.demo.com_chain.crt” (此行默认为注释状态,需去掉前面“#”)

向下(大约190行) 修改如下

Options _Indexes +Includes +followSymLinks +MultiViews
AllowOverride All
Require all granted

#文件尾部修改如下
CustomLog “logs/ssl_request.log”
其余不用修改!
至此,我们的apache 修改算是完成了,如果出现apache 启动失败,那就需要你自己查看一下文件路径是否正确,字母写的是否正确喽!

我们还需配置一下我们的服务器443端口。

点击如站规则

由于我这已经添加了443端口,没有的需要自己添加一下,左侧->新建规则->端口->填写端口号443->一直下一步即可!

至此,我们大功告成!!
原文:www.huxiale.cn

你可能感兴趣的:(配置证书)