• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            woaidongmao

            文章均收錄自他人博客,但不喜標題前加-[轉貼],因其丑陋,見諒!~
            隨筆 - 1469, 文章 - 0, 評論 - 661, 引用 - 0
            數據加載中……

            Web服務器之nginx介紹

              Nginx ("engine x") 是一個高性能的 HTTP 和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 代理服務器。 Nginx 是由 Igor Sysoev 為俄羅斯訪問量第二的 Rambler.ru 站點開發的,它已經在該站點運行超過兩年半了。Igor 將源代碼以類BSD許可證的形式發布。盡管還是測試版,但是,Nginx 已經因為它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名了。

              因為 Nginx 的文檔大部分是俄文的,Nginx 的中文維基的目的是幫助使用中文世界的用戶安裝、配置和交換有關 Nginx 的使用經驗。大部分文檔源自Aleksandar Lazic <al-nginx AT none DOT at>的工作。有關本維基本身的問題請直接詢問Cliff Wells <cliff AT develix DOT com>

              Nginx 可以在大多數 Unix like OS 上編譯運行,并有 Windows 移植版。目前 Nginx 的開發版為 0.7.x,穩定版為 0.6.x,歷史穩定版為 0.5.x,建議使用 0.6 系列作為生產版本。 Nginx 的源代碼使用 2-clause BSD-like license

              Nginx 的中文維基:http://wiki.codemongers.com/NginxChs

              Nginx 的中文站: http://www.nginx.cn

              ==為什么選擇Nginx ==

              Nginx 是一個很牛的高性能Web和反向代理服務器, 它具有有很多非常優越的特性:

              在高連接并發的情況下,NginxApache服務器不錯的替代品: 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 視頻);

              帶寬限制;

              實驗特性:

              內嵌的 perl

              通過 aio_read()/aio_write() 的套接字工作的實驗模塊,僅在 FreeBSD 下。

              對線程的實驗化支持,FreeBSD 4.x 的實現基于 rfork()

              Nginx 主要的英語站點是 http://sysoev.ru/en/

              英語文檔草稿由 Aleksandar Lazic 完成 點擊。

              ==常見問題(FAQ)==

              某些東東不工作 (URL重寫, 代理, 路徑, ...)

              例如: 如URL重寫(rewrite)不工作了或者是unix的路徑(/$PATH)的問題云云...

              請仔細閱讀 [NginxDebugging] 并且 逐行 查看錯誤日志。

              如果你沒找到錯誤 打起精神 試著到IRC或郵件列表里說明一下你碰到的問題。

              有沒有其它類似的Web服務器

              Cherokee

              Lighttpd (Lighty)

              thttpd

              關于各自的優缺點請使用自己喜歡的搜索引摯查找

              對于chroot的支持是否在計劃之中?

              有人知道嗎?

              在什么情況下使用Nginx比使用squid要好? 反之亦然。

              大體上來說nginx主要用于反向加速代理而不是像squid那樣做為常規代理服務器。Nginx的最大優勢在于高負載情況下內存和CPU的低消耗。 我不認為squid能給你帶來比nginx更好的性能。

              有沒有人能給出一個完整的.conf配置文件來詳細的解讀一下怎么配置和測試 IMAP 模塊, 而不只是關于 IMAP 的只言片語啊?

              依照 [NginxImapProxyExample] 開始你的配置. 關于不同配置參數的具體信息, 請查看 [NginxMailCoreModule] 頁。

              示例1: 用運行于apache上的php腳本做后端驗證

              示例2: 使用運行于同一個服務器的 nginx-embedded-perl 模塊作為 imap/pop代理和認證后端

              怎么讓Nginx成為以postfix做為后端的SMTP代理?

              有人知道不?

              Nginx使用什么算法來實現負載均衡? 它能實現基于連接數的負載均衡嗎?

              目前Nginx使用簡單的輪巡算法,所以無法做基本鏈接計數的負載均衡。這個可能會在將來的版本中有所改變。

              我能關閉從代理服務器到后端服務器的緩存嗎或者使用上傳進度特性?

              基于 太多人詢問下面的問題:

              我能為了得到上傳進度而關閉代理的緩存嗎

              使用nginx我怎么才能給用戶顯示上傳進度

              ...

              到目前為止 (2007-Apr-26) 還沒有辦法關閉到后端服務器的緩存.

              ==安裝Nginx==

              模塊依賴性

              gzip 模塊需要 zlib

              rewrite 模塊需要 pcre

              ssl 功能需要 openssl

              預先編譯好的安裝包

              Nginx在一些Linux發行版和BSD的各個變種版本的安裝包倉庫中都會有,通過各個系統自帶的軟件包管理方法即可安裝。需要注意的是,很多預先編譯好的安裝包都比較陳舊,大多數情況下還是推薦直接從源碼編譯。

              官方源代碼下載

              點擊下載源代碼

              特定平臺的安裝和記錄

              Nginx Slackware 上的編譯安裝腳本

              Nginx ubuntudebian上的安裝及腳本, debian針對nginx包的官方下載站點

              使用源代碼進行構建

              Nginx 使用 Unix 下常用的 './configure && make && make install' 過程來編譯安裝。

              configure 腳本確定系統所具有一些特性,特別是 nginx 用來處理連接的方法。然后,它創建 Makefile 文件。

              configure 支持下面的選項:

              --prefix=<path> - Nginx安裝路徑。如果沒有指定,默認為 /usr/local/nginx

              --sbin-path=<path> - Nginx可執行文件安裝路徑。只能安裝時指定,如果沒有指定,默認為<prefix>/sbin/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-cc=PATH - 指定 C 編譯器的路徑

              --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.)

            posted on 2008-12-24 20:54 肥仔 閱讀(1101) 評論(0)  編輯 收藏 引用 所屬分類: 網絡編程

            99久久久久| 99久久免费国产精精品| 久久久久国色AV免费看图片| 国产成人99久久亚洲综合精品| 久久九九久精品国产免费直播| 国产精品久久婷婷六月丁香| 久久国产劲爆AV内射—百度| 97久久超碰国产精品旧版| 色偷偷91久久综合噜噜噜噜| 久久AV无码精品人妻糸列| 久久久91精品国产一区二区三区| 久久亚洲高清综合| 欧美黑人激情性久久| 久久无码人妻精品一区二区三区| 天天爽天天狠久久久综合麻豆| 久久精品国产亚洲欧美| 色综合久久久久无码专区 | 亚洲AV无码一区东京热久久| 91超碰碰碰碰久久久久久综合| 国产69精品久久久久观看软件| 国产精品久久一区二区三区 | 久久精品国产一区二区电影| 久久久久久久女国产乱让韩| 久久国产精品二国产精品| 国内精品久久久久久99蜜桃| 久久久这里只有精品加勒比| 久久精品无码一区二区app| 一本久久a久久精品综合夜夜 | 久久久WWW成人免费毛片| 久久亚洲精品成人av无码网站| 久久久久久免费视频| 久久午夜综合久久| 久久九色综合九色99伊人| 国产999精品久久久久久| 伊人久久大香线蕉影院95| 国产亚洲精久久久久久无码77777| 国产精品免费久久久久久久久 | 欧美成a人片免费看久久| 色综合久久久久网| 99久久精品免费观看国产| 国内精品久久久久久久涩爱|