1.向证书机构申请https证书,会得到证书和私钥
2.安装apache的mod_ssl.so模块
yum -y install mod_ssl
3.若启用了防火墙需要添加https服务(service iptables status或者在使用firewall的情况下用 systemctl status firewalld)
用iptables的情况
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT (用于放行客户端请求https服务的报文)
iptables -A FORWARD -p tcp --sport 443 -j ACCEPT(用于放行https服务器发送给客户端的报文)
用firewall的情况
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
4.修改 ssl.conf
vim /etc/httpd/conf.d/ssl.conf
DocumentRoot "/var/www/html/test"
ServerName wxapp.peopleyuqing.com:443
SSLCertificateFile /etc/pki/tls/certs/test.crt
SSLCertificateKeyFile /etc/pki/tls/private/test.key

5.测试配置文件并重启apache
sudo httpd -t (或者sudo service httpd configtest)
sudo service httpd restart
原文:https://www.cnblogs.com/ryanlamp/p/6377637.html
网友评论