zoukankan      html  css  js  c++  java
  • RHEL/CentOS 安装最新版Nginx

      本篇简单介绍如何在RHEL/CentOS安装最新版本的Nginx。

      Step 1:安装yum-utils

    [root@localhost ~]# cat /etc/redhat-release 
    CentOS Linux release 7.6.1810 (Core) 
    [root@localhost ~]# yum install yum-utils -y

      Step 2:

      创建一个名为/etc/yum.repos.d/nginx.repo的配置文件,内容如下:

    [root@localhost ~]# vim /etc/yum.repos.d/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
    module_hotfixes=true
    
    [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
    module_hotfixes=true

      Step 3:(根据所需,可跳过)

      默认情况下,使用稳定nginx包的存储库。如果要使用主线nginx包,请运行以下命令:

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

      Step 4:安装nignx

    # sudo yum install nginx -y

      Step 5:查看版本

    [root@localhost ~]# nginx -v        # 稳定包版本
    nginx version: nginx/1.16.1
    
    [root@localhost ~]# nginx -v        # 主线nginx
    nginx version: nginx/1.17.5

      参考:

        http://nginx.org/en/linux_packages.html#RHEL-CentOS

  • 相关阅读:
    java 二维码图片生成工具类
    我的PHP学习过程
    js简单表格操作
    在同一个textarea文本框中设置不同的字体
    基础入门--创建项目
    异常处理方式
    2019年度的瞎几把总结
    WebAPI 返回值
    关于背景色
    使用echarts进行画图
  • 原文地址:https://www.cnblogs.com/Hi-blog/p/How-To-Install-Nginx-On-RHEL-CentOS.html
Copyright © 2011-2022 走看看