温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CentOS 强制apache全站使用https 加密SSL

发布时间:2020-07-15 06:45:27 阅读:2655 作者:990487026 栏目:开发技术
亿速云SSL证书,防劫持篡改、防监听窃取、提升搜索排名 点击了解>>

我的是yum安装的lamp平台,

apache 我已经配置好了 https访问。 

可以参照:架设CA服务器实现https通信,web服务器使用CA自签证书与https通信

http://990487026.blog.51cto.com/10133282/1686127

安装mod_ssl

[root@nb0001 html]# yum instyall mod_ssl openssl

修改配置文件

[root@nb0001 html]# vim /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Directory>

重启apache

[root@nb0001 html]
[root@nb0001 html]
[root@nb0001 html]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                              [  OK  ]

亿速云提供多种品牌、不同类型SSL证书签发服务,包含:域名型、企业型、企业型专业版、增强型以及增强型专业版,单域名SSL证书300元/年起。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×