码迷,mamicode.com
首页 > Web开发 > 详细

CentOS7下安装Apache并开启SSL

时间:2015-03-04 16:41:47      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

参考:

  •   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 --> HTTPS
RewriteEngine on RewriteCond
%{SERVER_PORT} !^443$      #另一种写法:RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]   #301表示永久移走

 

CentOS7下安装Apache并开启SSL

标签:

原文地址:http://www.cnblogs.com/flowjacky/p/4313440.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!