介绍


nginx是一款轻量级的http服务,它可以坐高并发的web服务,也可以做负载均··,现在进行 nginx基础教程

快速源码安··

    wget http://nginx.org/download/nginx-1.9.15.tar.gz
     tar zxf nginx-1.9.15.tar.gz 
    cd nginx-1.9.15
     ./configure --prefix=/usr/local/nginx-new --user=www --group=www  --with-poll_module\
       --with-threads   --with-file-aio     --with-http_ssl_module   --with-http_v2_module \
       --with-http_gzip_static_module   --with-pcre    --with-stream  \
         --with-http_gunzip_module   --with-http_dav_module \
     --with-http_geoip_module   --with-file-aio 
    make && make install

进程方式

nginx服务分为master进程和worker进程,master会对worker进程进行配置管理和维护··
nginx采用基于失误的管理模型有效的把请求分配给各个进程,可以使用固定配置也可以自动的调整可用的CPU数量··

默认的nginx配置文件目录"/usr/local/nginx-new/etc/nginx.conf"

启动、停止、重··

    [root@localhost nginx-1.9.15]# /usr/local/nginx-new/sbin/nginx -h
    nginx version: nginx/1.9.15
    Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]

    Options:
      -?,-h         : help
      -v            : version
      -V            : show version and configure options then exit
      -t            : 测试配置并退··
      -T            : 测试配置并dump出来退··
      -q            : 在配置和测试期间不输出错误日··
      -s signal     :发送一个消息给 master process:进行 stop, quit, reopen, reload
      -p prefix     : 设置nginx安装目录
      -c filename   : 指定配置文件(default: conf/nginx.conf)
      -g directives :配置文件的指定指··

    ./sbin/nginx -s { stop|quit | reopen | reload}
    stop    快速停止服务(强制停止当前服务··
    quit  优雅停止服务(等worker进程任务完成,再退出)
    reload reload服务
    reopen  重新打开日志文件

nginx进程信号

nginx可以使用进程信号控制,主进程把进程ID写入“xx/nginx.pid"
信号对照表:
TERM,INT 快速关··
QUIT 优雅关闭
USER1 重新打开日志文件
USER2 升级或者执行文··
WINCH 优雅关闭worker进程

nginx教程

第一·· nginx安装基本引导和进程信号

02-nginx IO模型

03-nginx负载均衡

04-nginx的root和alias区别

05-nginx limit_req和limit_conn_zone