高性能的 HTTP 和 反向代理服務器 Nginx
("engine x") 是一個高性能的 HTTP 和 反向代理服務器,也是一個IMAP/POP3/SMTP 代理服務器。 Nginx 是由Igor Sysoev為俄羅斯訪問量第二的 Rambler.ru 站點開發的,它已經在該站點運行超過兩年半了。Igor 將源代碼以類BSD許可證的形式發布。Nginx 已經因為它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名了。
Best of open source enterprise software(榮獲InfoWorld 2009年最佳開源平臺和中間件獎)
InfoWorld's 2009 Bossie Awards
Nginx 是一個很牛的高性能Web和反向代理服務器, 它具有有很多非常優越的特性:
在高連接并發的情況下,Nginx是Apache服務器不錯的替代品: Nginx在美國是做虛擬主機生意的老板們經常選擇的軟件平臺之一. 能夠支持高達 50,000 個并發連接數的響應, 感謝Nginx為我們選擇了 epoll and kqueue作為開發模型.
Nginx作為負載均衡服務器: Nginx 既可以在內部直接支持 Rails 和 PHP 程序對外進行服務, 也可以支持作為 HTTP代理服務器對外進行服務. Nginx采用C進行編寫, 不論是系統資源開銷還是CPU使用效率都比 Perlbal 要好很多.
作為郵件代理服務器: Nginx 同時也是一個非常優秀的郵件代理服務器(最早開發這個產品的目的之一也是作為郵件代理服務器), Last.fm 描述了成功并且美妙的使用經驗.
Nginx 是一個 安裝非常的簡單 , 配置文件 非常簡潔(還能夠支持perl語法), Bugs非常少的服務器: Nginx 啟動特別容易, 并且幾乎可以做到7*24不間斷運行,即使運行數個月也不需要重新啟動. 你還能夠 不間斷服務的情況下進行軟件版本的升級.
查看Nginx更多的特性: Feature Overview
==Nginx概述 ==
HTTP基礎功能:
處理靜態文件,索引文件以及自動索引;
反向代理加速(無緩存),簡單的負載均衡和容錯;
FastCGI,簡單的負載均衡和容錯;
模塊化的結構。過濾器包括gzipping, byte ranges, chunked responses, 以及 SSI-filter 。在SSI過濾器中,到同一個 proxy 或者 FastCGI 的多個子請求并發處理;
SSL 和 TLS SNI 支持;
IMAP/POP3 代理服務功能:
使用外部 HTTP 認證服務器重定向用戶到 IMAP/POP3 后端;
使用外部 HTTP 認證服務器認證用戶后連接重定向到內部的 SMTP 后端;
認證方法:
POP3: POP3 USER/PASS, APOP, AUTH LOGIN PLAIN CRAM-MD5;
IMAP: IMAP LOGIN;
SMTP: AUTH LOGIN PLAIN CRAM-MD5;
SSL 支持;
在 IMAP 和 POP3 模式下的 STARTTLS 和 STLS 支持;
支持的操作系統
FreeBSD 3.x, 4.x, 5.x, 6.x i386; FreeBSD 5.x, 6.x amd64;
Linux 2.2, 2.4, 2.6 i386; Linux 2.6 amd64;
Solaris 8 i386; Solaris 9 i386 and sun4u; Solaris 10 i386;
MacOS X (10.4) PPC;
結構與擴展:
一個主進程和多個工作進程。工作進程是單線程的,且不需要特殊授權即可運行;
kqueue (FreeBSD 4.1+), epoll (Linux 2.6+), rt signals (Linux 2.2.19+), /dev/poll (Solaris 7 11/99+), select, 以及 poll 支持;
kqueue支持的不同功能包括 EV_CLEAR, EV_DISABLE (臨時禁止事件), NOTE_LOWAT, EV_EOF, 有效數據的數目,錯誤代碼;
sendfile (FreeBSD 3.1+), sendfile (Linux 2.2+), sendfile64 (Linux 2.4.21+), 和 sendfilev (Solaris 8 7/01+) 支持;
輸入過濾 (FreeBSD 4.1+) 以及 TCP_DEFER_ACCEPT (Linux 2.4+) 支持;
10,000 非活動的 HTTP keep-alive 連接僅需要 2.5M 內存。
最小化的數據拷貝操作;
其他HTTP功能:
基于IP 和名稱的虛擬主機服務;
Memcached 的 GET 接口;
支持 keep-alive 和管道連接;
靈活簡單的配置;
重新配置和在線升級而無須中斷客戶的工作進程;
可定制的訪問日志,日志寫入緩存,以及快捷的日志回卷;
4xx-5xx 錯誤代碼重定向;
基于 PCRE 的 rewrite 重寫模塊;
基于客戶端 IP 地址和 HTTP 基本認證的訪問控制;
PUT, DELETE, 和 MKCOL 方法;
支持 FLV (Flash 視頻);
帶寬限制;
Basic HTTP features:
- Handling of static files, index files, and autoindexing; open file descriptor cache;
- Accelerated reverse proxying without caching; simple load balancing and fault tolerance;
- Accelerated support without caching of remote FastCGI servers; simple load balancing and fault tolerance;
- Modular architecture. Filters include gzipping, byte ranges, chunked responses, XSLT, and SSI. Multiple SSI inclusions within a single page can be processed in parallel if they are handled by FastCGI or proxied servers.
- SSL and TLS SNI support.
Mail proxy server features:
- User redirection to IMAP/POP3 backend using an external HTTP authentication server;
- User authentication using an external HTTP authentication server and connection redirection to internal SMTP backend;
- Authentication methods:
- POP3: USER/PASS, APOP, AUTH LOGIN PLAIN CRAM-MD5;
- IMAP: LOGIN, AUTH LOGIN PLAIN CRAM-MD5;
- SMTP: AUTH LOGIN PLAIN CRAM-MD5;
- SSL support;
- STARTTLS and STLS support.
Tested OS and platforms:
- FreeBSD 3 — 7 / i386; FreeBSD 5 — 7 / amd64;
- Linux 2.2 — 2.6 / i386; Linux 2.6 / amd64;
- Solaris 9 / i386, sun4u; Solaris 10 / i386, amd64, sun4v;
- MacOS X / ppc, i386;
Architecture and scalability:
- one master process and several workers processes. The workers run as unprivileged user;
- kqueue (FreeBSD 4.1+), epoll (Linux 2.6+), rt signals (Linux 2.2.19+), /dev/poll (Solaris 7 11/99+), event ports (Solaris 10), select, and poll support;
- various kqueue features support including EV_CLEAR, EV_DISABLE (to disable event temporalily), NOTE_LOWAT, EV_EOF, number of available data, error codes;
- sendfile (FreeBSD 3.1+, Linux 2.2+, Mac OS X 10.5), sendfile64 (Linux 2.4.21+), and sendfilev (Solaris 8 7/01+) support;
- accept-filter (FreeBSD 4.1+) and TCP_DEFER_ACCEPT (Linux 2.4+) support;
- 10,000 inactive HTTP keep-alive connections take about 2.5M memory;
- data copy operations are kept to a minimum.
Other HTTP features:
- name- and IP-based virtual servers;
- keep-alive and pipelined connections support;
- flexible configuration;
- reconfiguration and online upgrade without interruption of the client processing;
- access log formats, bufferred log writing, and quick log rotation;
- 4xx-5xx error codes redirection;
- rewrite module;
- access control based on client IP address and HTTP Basic authentication;
- PUT, DELETE, MKCOL, COPY and MOVE methods;
- FLV streaming;
- speed limitation;
- limitation of simultaneous connections or requests from one address.
Experimental features:
- embedded perl.