Blogger Information
Blog 12
fans 1
comment 1
visits 19004
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
云服务器配置免费的阿里云CA证书服务
黄小凡的博客
Original
1363 people have browsed it

    首先 前往阿里云注册免费的CA证书服务 传送门:注册免费的CA证书

1、先是购买免费型的CA证书

1.png

2、然后再从证书控制台里面补全你的证书信息,再点击下载证书

2.png

3.png

4.png


4、下载证书之后,解压会得到4个文件,一个公钥文件public.pem,一个私钥文件 后缀是.key文件具体可以看阿里云给出的介绍。找到你的apache安装目录,一般是在/etc/httpd 目录下,新建cert目录 然后用rz -e命令 把这四个文件上传到该目录下。

5、

打开 apache 安装目录下 conf 目录中的 httpd.conf 文件,找到以下内容并去掉“#”:

#LoadModule ssl_module modules/mod_ssl.so (如果找不到请确认是否编译过 openssl 插件)
#Include conf/extra/httpd-ssl.conf

如果没有的话,很有可能是你的php集成环境把这些load命令行放入了一个统一的文件进行加载,请注意看的你目录下有没有 这一句话 Include conf.modules.d/*.conf,总之找到#LoadModule ssl_module modules/mod_ssl.so 这一句话,意思是让apache加载ssl模块,然后 再包含#Include conf/extra/httpd-ssl.conf该文件,如果是linux下,很有可能是

Include conf.d/ssl.conf  ,如果没有ssl.conf,请安装 mod_ssl -y模块,yum install mod_ssl -y。(针对centOS系统,其他系统自习百度),编辑ssl.conf,在配置文件中查找以下配置语句:

# 添加 SSL 协议支持协议,去掉不安全的协议
SSLProtocol all -SSLv2 -SSLv3
# 修改加密套件如下
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM(根据自己的实际情况修改)
SSLHonorCipherOrder on
# 证书公钥配置
SSLCertificateFile cert/public.pem
# 证书私钥配置
SSLCertificateKeyFile cert/你的公钥(.key文件)
# 证书链配置,如果该属性开头有 '#'字符,请删除掉
SSLCertificateChainFile cert/chain.pem

6、接下来重启你的apache,systemctl restart httpd,如果如果有报错的话,试着把Include conf/extra/httpd-ssl.conf这一句话再重新注释掉!!!如果没报错的话,就成功了!此时在你的网站前加上https://  也能正常访问!

注意:

免费的CA证书一个域名只能配置一次!如果你的apache站点下有多个网站,请参考之前写的文章 apache搭建不同网站,配置好之后,当你使用http能正常访问的时候,再重复一次顺序1-2-3-4-5-6,并且 再去修改ssl.conf文件,在最后加入以下语句即可:

<VirtualHost *:443>

  ServerName "你的域名"

  DocumentRoot "网站对应的目录,一定要与vhosts.conf下配置的信息一样!"

  SSLEngine on

  SSLProtocol all -SSLv2 -SSLv3

  SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM(根据你的证书信息修改)

  SSLHonorCipherOrder on

  SSLCertificateFile "公钥"

  SSLCertificateKeyFile "私钥"

  SSLCertificateChainFile "证书链配置"

</VirtualHost>

最后就大功告成了!如果访问出现403错误的话,找到httpd.conf,把

DocumentRoot  和

<Directory "/目录">,改为你相应的网站目录即可!



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!