1. 安装环境
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2. 下载压缩包
mkdir /opt/software
cd /opt/software
wget -c https://nginx.org/download/nginx-1.22.0.tar.gz
tar -zxvf nginx-1.22.0.tar.gz
mkdir /usr/local/soft
mv nginx-1.22.0 /usr/local/soft/nginx
3. 安装Nginx
cd /usr/local/soft/nginx
./configure
make
make install
4. 启动Nginx
cd /usr/local/nginx/sbin
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
5. 查看nginx进程
ps aux | grep nginx
6. 重启Nginx
先停止再启动(推荐):
对 nginx 进行重启相当于先停止再启动,即先执行停止命令再执行启动命令。如下:
./nginx -s quit
./nginx