环境:centos7

一、yum安装nginx

配置阿里源

https://www.cnblogs.com/zgqbky/p/11722032.html

安装

  1. sudo yum -y install nginx # 安装nginx
  2. sudo yum remove nginx # 卸载 nginx

查看nginx安装的配置文件和目录

  1. rpm -ql nginx//查看nginx安装的配置文件和目录
  2. nginx -v //查看安装的版本
  3. nginx -V //查看编译时的参数

image.png
image.png
image.png启动、重启,停止

  1. systemctl start nginx // 启动nginx
  2. systemctl restart nginx
  3. systemctl stop nginx
  4. systemctl reload nginx// 重新加载配置文件

查看nginx运行状态

  1. ps -ef |grep nginx // 查看nginx运行状态
  2. pkill nginx //干掉nginx

image.png

遇到的问题:Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包

https://blog.csdn.net/dany_zj_cn/article/details/105499319
https://xiaotut.com/54-yy/jisuanji/19759-19759.html

二、下载nginx包安装

https://note.youdao.com/ynoteshare/index.html?id=8dcc3d60259b9ba4d894a13cf037554e&type=note&_time=1648087585049