让CentOS服务器支持https(安全http协议)
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
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。