yum install openssl
yum install openssl-devel

yum install httpd-devel

yum install mod_ssl openssl

修改SSL的设置文件

vi /etc/httpd/conf.d/ssl.conf

#DocumentRoot "/var/www/html"

  ← 找到这一行,将行首的“#”去掉

DocumentRoot "/var/www/html"

  ← 变为此状态

修改下面三行

SSLCertificateFile /usr/local/apache/conf/server.crt

SSLCertificateKeyFile /usr/local/apache/conf/server.key

Systemctl restart iptables.service

vi /etc/httpd/conf/httpd.conf

RewriteEngine on 
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]

重启httpd

systemctl restart httpd.service