zoukankan      html  css  js  c++  java
  • Linux下安装nginx

      一直会使用nginx,也学习了好多nginx知识。也在本地安装过nginx,这次是第一次在正式的环境安装nginx,把这些记录下来总结经验。

    一、安装环境

      操作系统:CentOS release 6.4 (Final)

      nginx版本:nginx-1.10.1

      Zlib:zlib-1.2.7

      Openssl:openssl-1.0.2h

      Pcre:pcre-8.21

    二、安装过程

      1、基础知识

        nginx需要依赖以下模块:

        gzip模块需要zlib库,我们使用zlib-1.2.7

        rewrite模块需要pcre库,我们使用pcre-8.21

        ssl功能需要openssl库。我们使用pcre-8.21

      2、安装过程

        2.1解压各个包

          tar zxvf  nginx-1.10.1.tar.gz (其他各个包依次使用该命令解压,记得各个包放的位置)

          tar -xvf pcre-8.21.tar.gz

          tar -xvf zlib-1.2.7.tar.gz

          tar -xvf openssl-1.0.0a.tar.gz

        2.2Configure  nginx参数

          ./configure --with-http_ssl_module --prefix=/liaowp/nginx --with-pcre=/liaowp/tools/pcre-8.21 --with-zlib=/liaowp/tools/zlib-1.2.7--with-openssl=/liaowp/tools/openssl-1.0.2h--with-http_stub_status_module --with-debug

          --prefix: set installation prefix   设置安装目录,如果没有指定默认 /usr/local/nginx

          --with-pcre=DIR:set path to PCRE library sources  pcre库的位置

          --with-zlib=DIR:set path to zlib library sources   zlib库的位置

          --with-openssl=DIR:set path to OpenSSL library sources  openssl的库的位置

          --with-debug  enable debug logging   开启debug日志

          --with-http_stub_status_module  enable ngx_http_stub_status_module 开启stub_status模块配置方法,Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.

          --with-xxx 模块启动xxx功能

          --without-xxx 模块禁用xxx功能

          执行完上面的命令出现下面这些就说明安装成功

          Configuration summary 

    + using PCRE library: /liaowp/tools/pcre-8.21 
    + using OpenSSL library: /liaowp/tools/openssl-1.0.2h 
    + md5: using OpenSSL library 
    + sha1: using OpenSSL library 
    + using zlib library: /liaowp/tools/zlib-1.2.7 
    nginx path prefix: "/liaowp/nginx" 
    nginx binary file: "/liaowp/nginx/sbin/nginx" 
    nginx modules path: "/liaowp/nginx/modules" 
    nginx configuration prefix: "/liaowp/nginx/conf" 
    nginx configuration file: "/liaowp/nginx/conf/nginx.conf" 
    nginx pid file: "/liaowp/nginx/logs/nginx.pid" 
    nginx error log file: "/liaowp/nginx/logs/error.log" 
    nginx http access log file: "/liaowp/nginx/logs/access.log" 
    nginx http client request body temporary files: "client_body_temp" 
    nginx http proxy temporary files: "proxy_temp" 
    nginx http fastcgi temporary files: "fastcgi_temp" 
    nginx http uwsgi temporary files: "uwsgi_temp" 
    nginx http scgi temporary files: "scgi_temp"

            最后发现并没有sbin目录,执行make然后make install就可以了。启动之报日志文件找不到,创建一个日志文件夹就可以了。至此安装完成。

            

     

     

    三、安装过程的典型问题

      1、缺少PCRE library

      

      2、缺少Zlib library

      

  • 相关阅读:
    Java 构造方法总结
    Intellij IDEA使用总结
    阿里巴巴Java开发手册
    灰度发布策略
    php redis 命令合集
    php redis 常用方法
    php excel 设置单元格格式为文本格式
    php curl get post 方法的封装
    PHP 判断手机号归属地 和 运营商的免费接口
    lnmp centos7 memcache服务器端 和 memcache memcached扩展的安装
  • 原文地址:https://www.cnblogs.com/liaoweipeng/p/5876866.html
Copyright © 2011-2022 走看看