Nginx 安装部署
1.下载 nginx 及相关组件
wget http://nginx.org/download/nginx-1.10.2.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz
安装 c++ 环境
yum install gcc-c++
2.安装 nginx
# openssl 安装
tar -zxvf openssl-fips-2.0.10.tar.gz -C /opt/module/nginx/
cd /opt/module/nginx/
./config && make && make install
# pcre 安装
tar -zxvf pcre-8.40.tar.gz -C /opt/module/nginx/
cd /opt/module/nginx/
./configure && make && make install
# zlib 安装
tar -zxvf zlib-1.2.11.tar.gz -C /opt/module/nginx/
cd /opt/module/nginx/
./configure && make && make install
# nginx 安装
tar -zxvf nginx-1.10.2.tar.gz -C /opt/module/nginx/
cd /opt/module/nginx/
./configure && make && make install
3.启动 nginx
# 查看 nginx 的安装目录
whereis nginx # nginx: /usr/local/nginx
# 启动 nginx
cd /usr/local/nginx
./sbin/nginx
nginx 启动报错:
./sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解决方案:
#1.查看 libpcre.so.1 的位置
whereis libpcre.so.1 # /usr/local/lib/libpcre.so.1
#2.libpcre.so.1 软连接到 lib64 目录下
ln -s /usr/local/lib/libpcre.so.1 /lib64/
重新启动 nginx
cd /usr/local/nginx/
./sbin/nginx
ps -aux | grep nginx