一.安装所需插件
1.安装gcc
查看gcc版本(一般会自带gcc)
gcc -v
如未安装,使用命令安装
yum -y install gcc
2.pcre、pcre-devel安装
yum install -y pcre pcre-devel
3.zlib安装
yum install -y zlib zlib-devel
4.安装openssl
yum install -y openssl openssl-devel
二.安装Nginx
1.下载nginx安装包
wget http://nginx.org/download/nginx-1.21.5.tar.gz
2.把压缩包解压到usr/local/java
tar -zxvf nginx-1.21.5.tar.gz
3.切换到cd /usr/local/java/nginx-1.21.5/下面,执行三个命令
./configure
make
make install
4.切换到/usr/local/nginx安装目录
cd /usr/local/nginx
5.切换目录到/usr/local/nginx/sbin下面
cd /usr/local/nginx/sbin
6.Nginx的启停和状态查看
启动Nginx
./nginx
查看Nginx是否启动成功
ps -ef | grep nginx
停止Nginx
./nginx -s stop
重启Nginx
./nginx -s reload