参考:
- http://www.bootf.com/563.html
- http://www.sunjianhe.com/?p=1238
- http://www.fwolf.com/blog/post/405
- http://httpd.apache.org/docs/2.4/ssl/ssl_howto.html
安装:
yum install -y openssl #使用openssl可手动创建证书 yum install -y httpd yum install -y mod_ssl#防火墙打开80、443端口,然后重启 firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --zone=public --add-port=443/tcp --permanent firewall-cmd --reload#Apache开启systemctl enable httpd systemctl start httpd
强制HTTP-->HTTPS:
vim /etc/httpd/conf/httpd.conf
#HTTP --> HTTPSRewriteEngine on RewriteCond %{SERVER_PORT} !^443$ #另一种写法:RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] #301表示永久移走
时间: 2024-10-20 04:32:29