美文网首页CentOS
【2.14】服务器安装 Linux中安装 Nginx

【2.14】服务器安装 Linux中安装 Nginx

作者: 王滕辉 | 来源:发表于2022-05-09 13:04 被阅读0次

    方法1

    yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
    yum install nginx -y
    

    方法2

    官网下载最新的tar包

    image.png
    #0.下载源码安装包
    webget http://nginx.org/download/nginx-1.21.6.tar.gz
    
    # 1.解压
    tar -zxvf /usr/local/nginx-1.21.6
    
    # 2.进入刚解压的目录
    cd nginx-1.21.6
        
    //3.使用nginx默认配置安装
    ./configure
        
    //4.安装
    make;
    make install;
    
    //5.查找安装路径
    whereis nginx
        
    //6.进入目录
    cd /usr/local/nginx/sbin
        
    //7.启动nginx
    ./nginx
        
    //8.查看是否启动
    ps -ef | grep nginx
        
    //安装完成
    

    浏览器访问 IP:端口


    image.png

    配制环境变量
    vi /etc/profile

    # 添加nginx的路径
    export PATH=$PATH:/usr/local/nginx/sbin
    

    修改conf参考 【3.5】服务器安装 Docker中安装与配置 Nginx 的conf/default.conf 设置

    相关文章

      网友评论

        本文标题:【2.14】服务器安装 Linux中安装 Nginx

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