CentOS7.9部署Nginx

简介

本章节主要讲的是在Linux系统CentOS7.9上去完成Nginx Web服务安装部署

步骤

1.配置 Nginx 源

2.yum 安装 Nginx

3.启动 Nginx

4.浏览默认站点

实施

1.配置 Nginx 源

// 执行如下命令
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

// 运行如下
[root@localhost ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Retrieving http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
warning: /var/tmp/rpm-tmp.G6IXR0: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:nginx-release-centos-7-0.el7.ngx ################################# [100%]
出现如上所示,则配置成功,也可以在/etc/yum.repos.d/ 下看到多了一个nginx.repo文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo       CentOS-Media.repo          docker-ce.repo
CentOS-CR.repo         CentOS-Sources.repo        nginx.repo
CentOS-Debuginfo.repo  CentOS-Vault.repo
CentOS-fasttrack.repo  CentOS-x86_64-kernel.repo

2.yum 安装 Nginx

yum install -y nginx

3.启动 Nginx

// 输入如下命令,没有报错,则启动成功
nginx

4.浏览默认站点

浏览器访问, IP:80

 

到此 Nginx 部署成功

posted @ 2024-06-30 10:47  MartyZane  阅读(111)  评论(0编辑  收藏  举报