- 安装依赖
yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
- 下载Nginx安装包
wget -c https://nginx.org/download/nginx-1.20.2.tar.gz
- 解压安装包
tar -zxvf nginx-1.18.0.tar.gz cd nginx-1.18.0
- 配置安装运行目录
./configure --prefix=/usr/local/nginx
- 编译安装
make&&make install
完活
常用命令
# 启动
/usr/local/nginx/sbin/nginx
#强制关闭
nginx -s stop
# 重启
nginx -s reload