linux快速安装Nginx

linux快速安装Nginx

  1. 安装yum依赖程序

    yum install -y yum-utils 
    
  2. 添加nginx的yum仓库

    cd /etc/yum.repos.d/      
    
  3. 配置相应信息保存并退出

vim nginx.repo 
  1. 将下边的信息复制粘贴并保存退出

    [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
    
  2. 安装nginx

    yum install -y nginx
    
  3. 如果出现获取 GPG 密钥失败:进行下载再进行导入key

    wget https://nginx.org/keys/nginx_signing.key --no-check-certificate
    rpm --import nginx_signing.key
    
  4. 启动并查看状态

    systemctl start nginx
    systemctl status nginx
    
  5. 查看并关闭防火墙状态

    systemctl status firewalld
    systemctl stop firewalld 
    

你可能感兴趣的:(linux,nginx,运维)