• 只需要一口茶的功夫 学会在CentOS上安装nginx


    1.安装工具包 wget、vim、gcc

    yum install -y wget

    yum install -y vim-enhanced

    yum install -y make cmake gcc gcc-c++

    2.下载nginx安装包

    wget http://nginx.org/download/nginx-1.6.2.tar.gz

    3.安装nginx的依赖包

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

    4.解压nginx-1.6.2.tar.gz到/usr/local/目录下

    tar -zxvf nginx-1.6.2.tar.gz -C /usr/local/

    5.进行configure配置

    进入nginx-1.6.2目录然后在执行./configure命令

    cd /usr/local/nginx-1.6.2/
    ./configure --prefix=/usr/local/nginx

    6.编译安装 

    make && make install

    7.启动Nginx,启动完之后检查nginx是否已经正常启动

    /usr/local/nginx/sbin/nginx  
    ps -ef | grep nginx

    8.看到如下信息说明正常启动 

    root      6338     1  0 17:48 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
    nobody    6339  6338  0 17:48 ?        00:00:00 nginx: worker process
    root      6342  1834  0 17:48 pts/0    00:00:00 grep --color=auto ngi

    9.配置防火墙,nginx默认的端口是80(有的可能没启动,就不管)

    firewall-cmd --zone=public --add-port=80/tcp --permanent  
    firewall-cmd --reload  

    10.测试Nginx(如果只需要测试nginx到这就结束了)

    通过浏览器访问nginx欢迎页,在地址栏输入:http://IP/(80端口可以不用输)或http://IP:80/ 

    11.配置Nginx

    在nginx目录下进入conf目录,该目录下有个nginx.conf文件,这是nginx最重要的配置文件 
    vim /usr/local/nginx

  • 相关阅读:
    芒格-“永远不要有受害者心态”
    JVM在哪里?
    leetcode-49.字母异位词分组
    VL5 位拆分与运算
    前端自动化测试之葵花宝典
    【走进Linux的世界】Linux---基本指令(1)
    基于STM32+NBIOT(BC26)设计的物联网观赏鱼缸
    c++ template traits
    SpringBoot 如何使用 JProfiler 进行性能测试
    理解GL_TRIANGLES、GL_TRIANGLE_STRIP、GL_TRIANGLE_FAN的形和意
  • 原文地址:https://blog.csdn.net/Da_Bao_zi/article/details/127575433