默认 apache 是没有安装 SSL 模块的, 如果网站想以 https 方式访问, 则需要安装并配置 ssl 模块
第一步: 下载 ssl 证书
不做介绍, 下载完成后, 证书一般包括 3 个文件
_public.crt 文件是证书文件,
_chain.crt 是证书链 (中间证书) 文件,
.key 文件是证书的私钥文件(申请证书时如果没有选择系统创建 CSR, 则没有该文件).
第二步: 安装 mod_ssl.so 模块
打开 apache 的配置文件:/etc/httpd/conf/httpd.conf
搜索'ssl', 如果没有, 就说明没有安装 mod_ssl.so 模块
现在 Apache 都自带了这个模块, 默认是不安装的. 安装方式有静态编译和动态加载.
动态安装我没弄明白, 所以采取了重新静态安装的方式
动态编译:
无需重新编译 apache, 使用 whereis openssl 查找 openssl 路径, 直接进入[source]/modules/ssl; 执行
[apache]/bin/apxs -a -i -c -L/usr/lib/openssl/engines/lib -c *.c -lcrypto -lssl -ldl
静态安装:
即在编译安装 apache 的时候, 在./configure 的时候添加 --enable--ssl, 这样 mod_ssl.so 模块就加载进了 Apache.
第二步: 下载安装 openssl
现在默认自带就有, 如果不放心可以手动再安装一次
- yum install openssl
- yum install openssl-devel
第三步: 安装 mod_ssl.so
现在 Apache 都自带了这个模块, 默认是不安装的. 安装方式有静态编译和动态加载.
动态编译
无需重新编译 apache, 使用 whereis openssl 查找 openssl 路径, 直接进入[source]/modules/ssl; 执行
[apache]/bin/apxs -a -i -c -L/usr/lib/openssl/engines/lib -c *.c -lcrypto -lssl -ldl;
来源: http://www.bubuko.com/infodetail-3452687.html