zoukankan      html  css  js  c++  java
  • Centos 下安装 Nginx(新)

    今天重新实践了下 CentOS 7.6 下安装 Nginx,总结了一条更直接并简单的方式

    从官方获取写入 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
    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
    

    将上面内容保存到文件 /etc/yum.repos.d/nginx.repo

    运行 yum

    运行 yum 安装命令,系统自动选择合适的仓库配置安装不出意外的话将会选择 nginx-stable 的配置

    yum install nginx
    

    将 nginx 设置为默认启动

    成功安装后,运行 systemctl 命令,将 nginx 设置为系统运行时自动启动,如有需要运行其它 systemctl 命令

    systemctl enable nginx
    
    # 控制台显示结果如下(centos8为例)
    Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service -> /usr/lib/systemd/system/nginx.service.
    

    其它 systemctl 命令

    systemctl is-enabled *.service #查询服务是否开机启动
    systemctl enable *.service #开机运行服务
    systemctl disable *.service #取消开机运行
    systemctl start *.service #启动服务
    systemctl stop *.service #停止服务
    systemctl restart *.service #重启服务
    systemctl reload *.service #重新加载服务配置文件
    systemctl status *.service #查询服务运行状态
    systemctl --failed #显示启动失败的服务
    systemctl list-units --type=service 查看所有已启动的服务
    
  • 相关阅读:
    javascript 下拉列表 自动取值 无需value
    gopkg:一种方便的go pakcage管理方式
    编译GDAL使用最新的HDF库配置文件
    leetcode:程序员面试技巧
    【Unity Shader实战】卡通风格的Shader(一)
    GDAL1.11版本对SHP文件索引加速测试
    【Unity Shaders】Shader学习资源和Surface Shader概述
    关于rowid的函数
    java基本类型的大小
    【转载】oracle之rowid详解
  • 原文地址:https://www.cnblogs.com/cinlap/p/11795025.html
Copyright © 2011-2022 走看看