1、安装
安装gcc
yum install -y gcc gcc-c++
安装pcre
cd /tmp/
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install
安装openssl
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz
tar -zxvf openssl-1.0.1j.tar.gz
cd openssl-1.0.1j
./config
make && make install
安装zlib
wget http://zlib.net/zlib-1.2.13.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
./configure
make && make instal
安装nginx
useradd www -U
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
2、报错
./configure: error: SSL modules require the OpenSSL library
编译时指定openssl
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module --with-openssl=/tmp/openssl-1.0.1j
验证openssl是否安装
openssl version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
openssl安装好了,还是提示找不到。先查一下位置,再添加软连接
find / -name libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1