[TOC]
nginx 的特點
- 模塊化設計,較好的擴展性
- 高可用 master/worker
- 支持熱部署,不停機更新配置文件
- 低內存消耗
- event-driven
nginx基本功能
- 靜態資源的web服務器
- http協議的反向代理服務器
- pop3/imap4協議反向代理服務器;
- FastCGI, uWSGI等協議的代理
- 模塊化功能加載
- web服務器相關功能:
虛擬主機,keepalive,訪問日志,url rewrite,路徑別名,基于IP及用戶的訪問控制,支付速率限制及并發數限制,...;
nginx的程序架構
- master/worker
一個master進程,可生成一個或多個worker進程;
master: 加載配置文件,管理worker進程,平滑升級,...;
worker: http服務,http代理,fastcgi代理,...;
nginx模塊類型
核心模塊:core module
標準模塊:
- standard HTTP modules
- Optional HTTP modules
- Mail modules
第三方模塊:
tengine源碼安裝
./configure --prefix=/usr/local/nginx \
--user=www --group=www \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-ipv6 --with-http_gzip_static_module \
--with-http_realip_module \
--with-http_flv_module --with-http_mp4_module \
--with-http_concat_module=shared --with-http_sysguard_module=shared \
--with-http_sub_module \
--with-pcre --with-pcre-jit
make && make install