写此篇博客是在配置nginx时总是报错,希望能够帮到大家,报错如下:
但是查看已经安装了相关openssl软件,最后源码配置编译解决了问题: 当然执行如下命令能解决问题最好
yum -y install openssl openssl-devel pcre pcre-devel zlib zlib-devel
执行以上操作依然报错,我才用了源码安装
步骤如下: 我的系统是centos7.2,需安装版本为:
Step 1: Install Development Tools
1.安装依赖 Development Tools
#<font color="#0000dd">On CentOS, RHEL & Fedora</font><br />
# yum group install 'Development Tools' && yum install perl-core libtemplate-perl zlib-devel
'On Ubuntu & Debian'
$ sudo apt update && apt install build-essential checkinstall zlib1g-dev libtemplate-perl
Step 2: Compile OpenSSL from Sources
2.下载Openssl并解压
wget -c https://www.openssl.org/source/openssl-1.0.2p.tar.gz
tar -xzvf openssl-1.0.2p.tar.gz
3.编译安装
cd openssl-1.0.2k/
./config
make
出现如下字样,表示编译成功
make test
出现如下字样,表示编译测试成功
make install
出现如下字样,表示编译安装成功
4.查看已安装完成的Openssl
cd /usr/local/ssl
对以上文件进行解释:
** bin** – contains the openssl binary and some utility scripts.
include/openssl – contains the header files needed for building your own programs that use libcrypto or libssl.
lib -contains the OpenSSL library files.
lib/engines – contains the OpenSSL dynamically loadable engines.
man – contains the OpenSSL man-pages.
share/doc/openssl/html – contains HTML rendition of the man-pages.
certs – the default location for certificate files.
private – the default location for private key files.
5.检查Openssl版本信息
/usr/local/ssl/bin/openssl version
OpenSSL 1.0.2k 26 Jan 2017
6. 添加 /usr/local/ssl/bin/ 到环境变量
vim ~/.bashrc
在最后添加:
export PATH="/usr/local/ssl/bin:${PATH}"
保存文件,并使环境变量生效
source .bashrc
7. 查看环境变量是否添加成功
whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/include/openssl /usr/local/ssl/bin/openssl /usr/share/man/man1/openssl.1ssl.gz
openssl version
OpenSSL 1.0.2k 26 Jan 2017
安装编译完成可以去编译nginx支持ssl模块了