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

一、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:文章来源地址https://uudwc.com/A/rXRJ2

./nginx -s stop 

原文地址:https://blog.csdn.net/weixin_42728126/article/details/131684464

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

h
上一篇 2023年07月13日 09:42
【C语言趣味教程】(2) 整数类型 | 数据类型的概念 | 原码反码与补码 | 有符号型和无符类型 | 研究 signed char 与 unsigned char 的取值范围
下一篇 2023年07月13日 09:42