Linux下apache配置https方法教程

Linux 下apache 配置https 方法教程Linux 下apache 怎么配置https 访问,Linux 下apache 配置https 方法教程,apache 配置https 方法步骤介

Linux 下apache 配置https 方法教程

Linux 下apache 怎么配置https 访问,Linux 下apache 配置https 方法教程,apache 配置https 方法步骤介绍。

1. 安装Openssl

要使Apache 支持SSL ,需要首先安装Openssl 支持。

下载Openssl :http://www.openssl.org/source/ ;

tar -zxf openssl-1.0.1h.tar.gz //解压安装包;

cd openssl-1.0.1h //进入已经解压的安装包;

./config //配置安装,推荐使用默认配置;

make && make install //编译及安装;

openssl 默认将被安装到/usr/local/ssl当然这里的路径也可以指定安装路径;

2. 安装Apache

./configure --prefix=/usr/local/apache --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-mods-shared=all //配置安装,推荐动态编译模块。

make&& make install

动态编译Apache 模块,便于模块的加载管理。Apache 将被安装到/usr/local/apache

3. 申请证书

去沃通WoSign 官网http://www.wosign.com申请一张EV SSL证书,申请成功后,会得到一个有密码的压缩包文件,输入证书密码后解压得到五个文件:

forApache 、forIIS 、forNgnix 、forTomcat 、forOther Server,这个是证书的几种格式,Apache 上需要用到forApache 格式的证书。

4. 安装ssl 证书

a 、打开apache 安装目录下conf 目录中的httpd.conf 文件,找到 #LoadModulessl_module modules/mod_ssl.so

#Includeconf/extra/httpd_ssl.conf

删除行首的配置语句注释符号“#”

保存退出。

,

b 、打开apache 安装目录下conf/extra目录中的httpd-ssl.conf 文件 在配置文件中查找以下配置语句,去掉不安全的加密协议如下 SSLProtocolall -SSLv2 -SSLv3

将服务器证书公钥配置到该路径下

SSLCertificateFileconf/ssl.crt/test.wosign.com.crt (证书公钥) 将服务器证书私钥配置到该路径下

SSLCertificateKeyFileconf/ssl.key/test.wosign.com.key (证书私钥) 将服务器证书链配置到该路径下

#SSLCertificateChainFileconf/ssl.crt/root_bundle.crt(证书链) 删除行首的“#”号注释符

5. 测试安装结果

访问https :// 证书绑定的域名,测试效果。

注:部署完毕后若网站无法通过https 正常访问,可确认服务器443端口是否开启或被网站卫士等加速工具拦截。

(1)开启方法:防火墙设置-例外端口-添加443端口(TCP)。

(2)若被安全或加速工具拦截,可以在拦截记录中将443添加至信任列表。

重启后,重新通过https 访问。

标签: