在/opt/nginx目录下操作

下载

wget http://nginx.org/download/nginx-1.14.2.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz

安装

gcc安装

yum -y install gcc gcc-c++

openssl安装

cd /opt/nginx/
tar -zxvf openssl-fips-2.0.9.tar.gz
cd /opt/nginx/openssl-fips-2.0.9
./config && make && make install

pcre安装

cd /opt/nginx/
tar -zxvf pcre-8.36.tar.gz
cd /opt/nginx/pcre-8.38
./configure && make && make install

zlib安装

cd /opt/nginx/
tar -zxvf zlib-1.2.11.tar.gz
cd /opt/nginx/zlib-1.2.11
./configure && make && make install

nginx安装

cd /opt/nginx/
tar -zxvf nginx-1.14.2.tar.gz
cd /opt/nginx/nginx-1.14.2
./configure && make && make install

nginx命令

# 命令目录/usr/local/nginx/sbin/
nginx # 启动
nginx -s reload # 修改配置后重新加载生效
nginx -s reopen # 重新打开日志文件
nginx -t -c /path/to/nginx.conf # 测试nginx配置文件是否正确

关闭nginx:
nginx -s stop # 快速停止nginx
nginx -s quit # 完整有序的停止nginx
文档更新时间: 2019-11-09 21:52   作者:Eddy