码迷,mamicode.com
首页 > 其他好文 > 详细

centos7安装nginx

时间:2019-07-16 10:49:28      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:command   cal   code   linu   etc   安装   官网   图片   named   

官网安装教程地址:http://nginx.org/en/linux_packages.html#RHEL-CentOS

官网描述如下

RHEL/CentOS

Install the prerequisites:

    sudo yum install yum-utils

To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

    [nginx-stable]
    name=nginx stable repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=1
    enabled=1
    gpgkey=https://nginx.org/keys/nginx_signing.key

    [nginx-mainline]
    name=nginx mainline repo
    baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=https://nginx.org/keys/nginx_signing.key

By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:

    sudo yum-config-manager --enable nginx-mainline

To install nginx, run the following command:

    sudo yum install nginx

When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it. 

 

第一步:sudo yum install yum-utils

第二步:

  在路径/etc/yum.repos.d/nginx.repo,新增文件nginx.repo

  在文件中写入

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

因为linux菜鸟,新增文件这些命令也记录一下

cd
cd /etc/yum.repos.d
sudo touch nginx.repo
sudo vi nginx.repo
复制粘贴上述内容,按esc,输入:wq
如此文件新增完成

 

第三步:sudo yum install nginx

 

 

 

打开浏览器,输入localhost,如果出现以下页面,则说明已经按照运行成功

技术图片

 

 

  

centos7安装nginx

标签:command   cal   code   linu   etc   安装   官网   图片   named   

原文地址:https://www.cnblogs.com/rukawafans/p/11193088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!