1.获取安装包
wget https://nginx.org/download/nginx-1.20.2.tar.gz
2.解压安装包
tar -zxvf nginx-1.20.2.tar.gz
3.安装依赖
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
4.安装nginx
cd nginx-1.20.2/
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
make
make install
5.检查nginx版本
cd /usr/local/nginx/sbin/
./nginx -v
6.增加软连接
cd /usr/bin/
ln -s /usr/local/nginx/sbin/nginx nginx
7.启动机相关命令
启动: nginx
停止:nginx -s stop
重载配置: nginx -s reload
配置文件位置:/usr/local/nginx/conf/nginx.conf