首页 > 开发 > Nginx > 正文

centos7安装nginx的两种方法介绍

2020-07-28 15:47:27
字体:
来源:转载
供稿:网友
本篇文章主要介绍了centos7安装nginx的两种方法介绍,主要是通过两种方式进行安装,有兴趣的可以了解一下。

centos7安装nginx

第一种方式:通过yum安装

直接通过 yum install nginx 肯定是不行的,因为yum没有nginx,所以首先把 nginx 的源加入 yum 中。

运行下面的命令:

1.将nginx放到yum repro库中

复制代码 代码如下:
[root@localhost ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.查看nginx信息

[root@localhost ~]# yum info nginx

3.使用yum安装ngnix

[root@localhost ~]# yum install nginx

效果如下:

[root@localhost ~]# yum install nginx

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.usc.edu

 * extras: mirror.raystedman.net

 * updates: mirror.metrocast.net

正在解决依赖关系

--> 正在检查事务

---> 软件包 nginx.x86_64.1.1.10.1-1.el7.ngx 将被 安装
      ・・・・・・
      ・・・・・・

正在安装    : 1:nginx-1.10.1-1.el7.ngx.x86_64       

Thanks for using nginx!
Please find the official documentation for nginx here:

* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:

* http://nginx.com/products/

----------------------------------------------------------------------

  验证中      : 1:nginx-1.10.1-1.el7.ngx.x86_64                                                                                 1/1

已安装:

nginx.x86_64 1:1.10.1-1.el7.ngx                                                                                    

完毕!

4.启动nginx

[root@localhost ~]# service nginx start

5.查看nginx版本

[root@localhost ~]# nginx -v
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表