[NGINX] NGINX下载、安装编译、启动检查停止命令

44 篇文章 4 订阅
2 篇文章 0 订阅

一、NGINX 下载

mkdir -p /soft/nginx
cd /soft/nginx
wget https://nginx.org/download/nginx-1.21.6.tar.gz

二、下载相关依赖

①在线安装依赖:

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 

②下载依赖到本地安装依赖:

yum install --downloadonly --downloaddir=/soft/nginx/ gcc-c++
yum install --downloadonly --downloaddir=/soft/nginx/ pcre pcre-devel4
yum install --downloadonly --downloaddir=/soft/nginx/ zlib zlib-devel
yum install --downloadonly --downloaddir=/soft/nginx/ openssl openssl-devel
cd  /soft/nginx
rpm -ivh --nodeps *.rpm

建议内网先下载安装包和依赖通过介质拷贝至系统;

三、NGINX 安装编译

cd /soft/nginx
tar -zxvf nginx-1.21.6.tar.gz
cd nginx-1.21.6 
./configure 
make
make install

注:编译后会在安装目录的同层(/soft/nginx/)生成nginx应用目录,相关配置、启动在此层。而不是在安装目录下一层(/soft/nginx/nginx-1.21.6/)或者使用whereis nginx查看软件目录,如果查询没有反应,以前者为准。
在这里插入图片描述

三、NGINX 启动和其他相关命令

启动nginx:

cd /soft/nginx/sbin/
./nginx

检查nginx是否启动:

ps aux | grep nginx

在这里插入图片描述
检测nginx配置文件是否正常 :

./nginx -t -c conf/nginx.conf   

修改配置后平滑重启:

./nginx -s reload -c conf/nginx.conf 

执行完当前的任务后再退出:

./nginx -s quit 

强制终止Nginx:

./nginx -s stop 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值