美文网首页
centos 安装最新的稳定版nginx

centos 安装最新的稳定版nginx

作者: 松上有婵 | 来源:发表于2019-08-08 16:02 被阅读0次
    1. 安装yum-utils
    sudo yum -y install yum-utils
    

    2.新建文件/etc/yum.repos.d/nginx.repo

    cat <<ENDOF >/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
    
    [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
    ENDOF
    

    3.yum 安装nginx

    sudo yum -y install nginx
    

    4.运行nginx

    nginx
    

    5.查看nginx相关文件位置

    whereis nginx
    

    结果显示如下

    nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
    

    配置文件保存在/etc/nginx
    默认根目录/usr/share/nginx/html

    相关文章

      网友评论

          本文标题:centos 安装最新的稳定版nginx

          本文链接:https://www.haomeiwen.com/subject/xibxjctx.html