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

2023-05-12,,

我的是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  ]

《CentOS 强制apache全站使用https 加密SSL.doc》

下载本文的Word格式文档,以方便收藏与打印。