CentOs7.3用yum方式安装Nginx

nginx:

  安装版本:1.16.0
安装方式:yum
安装步骤:
第一步:添加yum源(该命令执行之后,会在/etc/yum.respos.d下面多出一个nginx.repo)

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

  第二步:安装

yum -y install nginx

  第三步:查看nginx的默认安装目录

whereis nginx
(1) Nginx配置路径:/etc/nginx/
(2) PID目录:/var/run/nginx.pid
(3) 错误日志:/var/log/nginx/error.log
(4) 访问日志:/var/log/nginx/access.log
(5) 默认站点目录:/usr/share/nginx/html

  命令:
重启系统服务:

sudo systemctl daemon-reload

  设置开机启动:

sudo systemctl enable nginx

  启动:

sudo systemctl start nginx

  停止:

sudo systemctl stop nginx

  重启:

sudo systemctl restart nginx

  查看状态:

sudo systemctl status nginx