引用:
<dl></dl>
<dd></dd>
展開

nginx map
作為郵件代理伺服器:Nginx 同時也是一個非常優秀的郵件代理伺服器(最早開發這個産品的目的之一也是作為郵件代理伺服器),Last. fm 描述了成功并且美妙的使用經驗。
Nginx 是一個安裝非常的簡單,配置檔案非常簡潔(還能夠支援perl文法),Bugs非常少的伺服器:Nginx 啟動特别容易,并且幾乎可以做到7*24不間斷運作,即使運作數個月也不需要重新啟動。你還能夠不間斷服務的情況下進行軟體版本的更新。
處理靜态檔案,索引檔案以及自動索引;
反向代理加速(無緩存),簡單的負載均衡和容錯;
FastCGI,簡單的負載均衡和容錯;
子產品化的結構。過濾器包括gzipping, byte ranges, chunked responses, 以及 SSI-filter 。在SSI過濾器中,到同一個 proxy 或者 FastCGI 的多個子請求并發處理;
SSL 和 TLS SNI 支援;
IMAP/POP3 代理服務功能:
使用外部 HTTP 認證伺服器重定向使用者到 IMAP/POP3 後端;
使用外部 HTTP 認證伺服器認證使用者後連接配接重定向到内部的 SMTP 後端;
基于名稱和基于IP的虛拟伺服器;
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;通路日志格式,bufferred日志寫,快速登入旋轉;
3xx-5xx error codes redirection; 3xx的- 5xx錯誤代碼重定向;
The rewrite module;重寫子產品;
Access control based on client IP address and HTTP Basic authentication;通路控制基于用戶端IP位址和HTTP基本認證;
The PUT, DELETE, MKCOL, COPY and MOVE methods;在PUT,DELETE鍵,MKCOL,複制和移動方法;
FLV streaming;的FLV流;
Speed limitation;車速限制;
Limitation of simultaneous connections or requests from one address.限制同時連接配接或從一個位址的請求。
Embedded perl.嵌入式的Perl。
使用者重定向到IMAP/POP3後端使用外部HTTP認證伺服器;
User authentication using an external HTTP authentication server and connection redirection to internal SMTP backend;使用者身份驗證使用外部HTTP認證伺服器和連接配接重定向到内部的SMTP後端;
Authentication methods:驗證方法:
POP3: USER/PASS, APOP, AUTH LOGIN/PLAIN/CRAM-MD5;的POP3:使用者名/密碼,的APOP,AUTH的LOGIN/PLAIN/CRAM-MD5;
IMAP: LOGIN, AUTH LOGIN/PLAIN/CRAM-MD5; IMAP的:登入,AUTH的LOGIN/PLAIN/CRAM-MD5;
SMTP: AUTH LOGIN/PLAIN/CRAM-MD5;的SMTP:AUTH的LOGIN/PLAIN/CRAM-MD5;
SSL support; SSL支援;
STARTTLS and STLS support. STARTTLS的和補充的支援。
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;
Windows XP和Windows Server 2003中。
一個主程序和多個工作程序。工作程序是單線程的,且不需要特殊授權即可運作;
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+) 支援;
最小化的資料拷貝操作;
其他HTTP功能:
基于IP 和名稱的虛拟主機服務;
Memcached 的 GET 接口;
支援 keep-alive 和管道連接配接;
靈活簡單的配置;
重新配置和線上更新而無須中斷客戶的工作程序;
可定制的通路日志,日志寫入緩存,以及快捷的日志回卷;
4xx-5xx 錯誤代碼重定向;
PUT, DELETE, 和 MKCOL 方法;
支援 FLV (Flash 視訊);
帶寬限制;
内嵌的 perl
通過 aio_read()/aio_write() 的套接字工作的實驗子產品,僅在 FreeBSD 下。
對線程的實驗化支援,FreeBSD 4.x 的實作基于 rfork()
Nginx 主要的英語站點是 http://sysoev. ru/en/
英國文檔草稿由 Aleksandar Lazic 完成 點選。
(URL重寫, 代理, 路徑, ...)
例如: 如URL重寫(rewrite)不工作了或者是unix的路徑(/$PATH)的問題雲雲...
請仔細閱讀 [NginxDebugging] 并且 逐行 檢視錯誤日志。
如果你沒找到錯誤 打起精神 試着到IRC或郵件清單裡說明一下你碰到的問題。
有沒有其它類似的Web伺服器
Cherokee
Lighttpd (Lighty)
thttpd
關于各自的優缺點請使用自己喜歡的搜尋引摯查找
在什麼情況下使用Nginx比使用squid要好? 反之亦然。
大體上來說nginx主要用于反向加速代理而不是像squid那樣做為正常代理伺服器。Nginx的最大優勢在于高負載情況下記憶體和CPU的低消耗。 我不認為squid能給你帶來比nginx更好的性能。
有沒有人能給出一個完整的.conf配置檔案來詳細的解讀一下怎麼配置和測試 IMAP 子產品, 而不隻是關于 IMAP 的隻言片語啊?
依照 [NginxImapProxyExample] 開始你的配置. 關于不同配置參數的具體資訊,請檢視 [NginxMailCoreModule] 頁。
示例2: 使用運作于同一個伺服器的 nginx-embedded-perl 子產品作為 imap/pop代理和認證後端
Nginx使用什麼算法來實作負載均衡? 它能實作基于連接配接數的負載均衡嗎?
目前Nginx使用簡單的輪巡算法,是以無法做基本連結計數的負載均衡。 這個可能會在将來的版本中有所改變。
我能關閉從代理伺服器到後端伺服器的緩存嗎或者使用上傳進度特性?
我能為了得到上傳進度而關閉代理的緩存嗎
使用nginx我怎麼才能給使用者顯示上傳進度
...
到目前為止 (2007-Apr-26) 還沒有辦法關閉到後端伺服器的緩存.
gzip 子產品需要 zlib 庫
rewrite 子產品需要 pcre 庫
ssl 功能需要 openssl 庫
特定平台的安裝和記錄
Nginx 在 Slackware 上的編譯安裝腳本
Nginx 在ubuntu和debian上的安裝及腳本, debian針對nginx包的官方下載下傳站點
使用源代碼進行建構
Nginx 使用 Unix 下常用的 './configure && make && make install' 過程來編譯安裝。
configure 腳本确定系統所具有一些特性,特别是 nginx 用來處理連接配接的方法。然後,它建立 Makefile 檔案。
configure 支援下面的選項:
--prefix=<path> - Nginx安裝路徑。如果沒有指定,預設為 /usr/local/nginx。
--conf-path=<path> - 在沒有給定-c選項下預設的nginx.conf的路徑。如果沒有指定,預設為<prefix>/conf/nginx.conf。
--pid-path=<path> - 在nginx.conf中沒有指定pid指令的情況下,預設的nginx.pid的路徑。如果沒有指定,預設為 <prefix>/logs/nginx.pid。
--lock-path=<path> - nginx.lock檔案的路徑。
--error-log-path=<path> - 在nginx.conf中沒有指定error_log指令的情況下,預設的錯誤日志的路徑。如果沒有指定,預設為 <prefix>/logs/error.log。
--http-log-path=<path> - 在nginx.conf中沒有指定access_log指令的情況下,預設的通路日志的路徑。如果沒有指定,預設為 <prefix>/logs/access.log。
--user=<user> - 在nginx.conf中沒有指定user指令的情況下,預設的nginx使用的使用者。如果沒有指定,預設為 nobody。
--group=<group> - 在nginx.conf中沒有指定user指令的情況下,預設的nginx使用的組。如果沒有指定,預設為 nobody。
--builddir=DIR - 指定編譯的目錄
--with-rtsig_module - 啟用 rtsig 子產品
--with-select_module --without-select_module - Whether or not to enable the select module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.
//允許或不允許開啟SELECT模式,如果 configure 沒有找到更合适的模式,比如:kqueue(sun os),epoll (linux kenel 2.6+), rtsig(實時信号)或者/dev/poll(一種類似select的模式,底層實作與SELECT基本相 同,都是采用輪訓方法) SELECT模式将是預設安裝模式
--with-poll_module --without-poll_module - Whether or not to enable the poll module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.
--with-http_ssl_module - Enable ngx_http_ssl_module. Enables SSL support and the ability to handle HTTPS requests. Requires OpenSSL. On Debian, this is libssl-dev.
//開啟HTTP SSL子產品,使NGINX可以支援HTTPS請求。這個子產品需要已經安裝了OPENSSL,在DEBIAN上是libssl
--with-http_realip_module - 啟用 ngx_http_realip_module
--with-http_addition_module - 啟用 ngx_http_addition_module
--with-http_sub_module - 啟用 ngx_http_sub_module
--with-http_dav_module - 啟用 ngx_http_dav_module
--with-http_flv_module - 啟用 ngx_http_flv_module
--with-http_stub_status_module - 啟用 "server status" 頁
--without-http_charset_module - 禁用 ngx_http_charset_module
--without-http_gzip_module - 禁用 ngx_http_gzip_module. 如果啟用,需要 zlib 。
--without-http_ssi_module - 禁用 ngx_http_ssi_module
--without-http_userid_module - 禁用 ngx_http_userid_module
--without-http_access_module - 禁用 ngx_http_access_module
--without-http_auth_basic_module - 禁用 ngx_http_auth_basic_module
--without-http_autoindex_module - 禁用 ngx_http_autoindex_module
--without-http_geo_module - 禁用 ngx_http_geo_module
--without-http_map_module - 禁用 ngx_http_map_module
--without-http_referer_module - 禁用 ngx_http_referer_module
--without-http_rewrite_module - 禁用 ngx_http_rewrite_module. 如果啟用需要 PCRE 。
--without-http_proxy_module - 禁用 ngx_http_proxy_module
--without-http_fastcgi_module - 禁用 ngx_http_fastcgi_module
--without-http_memcached_module - 禁用 ngx_http_memcached_module
--without-http_limit_zone_module - 禁用 ngx_http_limit_zone_module
--without-http_empty_gif_module - 禁用 ngx_http_empty_gif_module
--without-http_browser_module - 禁用 ngx_http_browser_module
--without-http_upstream_ip_hash_module - 禁用 ngx_http_upstream_ip_hash_module
--with-http_perl_module - 啟用 ngx_http_perl_module
--with-perl_modules_path=PATH - 指定 perl 子產品的路徑
--with-perl=PATH - 指定 perl 執行檔案的路徑
--http-log-path=PATH - Set path to the http access log
--http-client-body-temp-path=PATH - Set path to the http client request body temporary files
--http-proxy-temp-path=PATH - Set path to the http proxy temporary files
--http-fastcgi-temp-path=PATH - Set path to the http fastcgi temporary files
--without-http - 禁用 HTTP server
--with-mail - 啟用 IMAP4/POP3/SMTP 代理子產品
--with-mail_ssl_module - 啟用 ngx_mail_ssl_module
--with-cpp=PATH - 指定 C 預處理器的路徑
--with-cc-opt=OPTIONS - Additional parameters which will be added to the variable CFLAGS. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-cc-opt="-I /usr/local/include". If we are using select() and it is necessary to increase the number of file descriptors, then this also can be assigned here: --with-cc-opt="-D FD_SETSIZE=2048".
--with-ld-opt=OPTIONS - Additional parameters passed to the linker. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-ld-opt="-L /usr/local/lib".
--with-cpu-opt=CPU - 為特定的 CPU 編譯,有效的值包括:pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64
--without-pcre - 禁止 PCRE 庫的使用。同時也會禁止 HTTP rewrite 子產品。在 "location" 配置指令中的正規表達式也需要 PCRE 。
--with-pcre=DIR - 指定 PCRE 庫的源代碼的路徑。
--with-pcre-opt=OPTIONS - Set additional options for PCRE building.
--with-md5=DIR - Set path to md5 library sources.
--with-md5-opt=OPTIONS - Set additional options for md5 building.
--with-md5-asm - Use md5 assembler sources.
--with-sha1=DIR - Set path to sha1 library sources.
--with-sha1-opt=OPTIONS - Set additional options for sha1 building.
--with-sha1-asm - Use sha1 assembler sources.
--with-zlib=DIR - Set path to zlib library sources.
--with-zlib-opt=OPTIONS - Set additional options for zlib building.
--with-zlib-asm=CPU - Use zlib assembler sources optimized for specified CPU, valid values are: pentium, pentiumpro
--with-openssl=DIR - Set path to OpenSSL library sources
--with-openssl-opt=OPTIONS - Set additional options for OpenSSL building
--with-debug - 啟用調試日志
--add-module=PATH - Add in a third-party module found in directory PATH
在不同版本間,選項可能會有些許變化,請總是使用 ./configure --help 指令來檢查一下目前的選項清單。
./configure \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=../pcre-4.4 \
--with-zlib=../zlib-1.1.3
Example on Ubuntu/debian with libgcrypt11-dev, libpcre3-dev and libssl-dev installed (choose EITHER --with-md5 OR --with-sha1, but not both; on debian and ubuntu, they should both point to /usr/lib)
./configure --with-openssl=/usr/lib/ssl/ --with-md5=/usr/lib
An Ubuntu Edgy .deb for version 0.5.2 can be found here: nginx_0.5.2-1_i386.deb.
(NOTE: According to an October 2006 message md5 was used in a now broken http cache module and sha1 is used in an incomplete mysql library module and so are currently not needed.)
<dt>擴充閱讀:</dt>
1
2
<dt>開放分類:</dt>