从nginx官网下载stable version安装包
wget http://nginx.org/download/nginx-1.16.0.tar.gz
安装依赖库
yum install gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel
解压nginx安装包
tar -zxvf nginx-1.16.0.tar.gz
进入到nginx目录,对安装的软件进行配置以及检查当前的环境是否满足要安装软件的依赖关系
./configure
源码编译
make
安装nginx
make install
配置nginx系统服务
vim /lib/systrm/system/nginx.service
nginx.service文件中内容
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=
/usr/local/nginx/sbin/nginx
ExecReload=
/usr/local/nginx/sbin/nginx
reload
ExecStop=
/usr/local/nginx/sbin/nginx
quit
PrivateTmp=
true
[Install]
WantedBy=multi-user.target
原文:https://www.cnblogs.com/networkoperation/p/11061287.html