1. 程式人生 > >五大開源Web伺服器

五大開源Web伺服器

開源產品的出現不僅獲得了個人使用者的喜愛,眾多知名企業也青睞於它。雖然開源產品數不勝數,但並不是每一個開源產品都能被廣泛應用並得到大眾的好評。在眾多成功的開源產品中,只有少數領頭羊,而其它產品只能望其項背。本文彙總了五款開源Web伺服器,來看看有沒有你需要的吧!

  Apache

  Apache

  Apache是一個免費的網路伺服器系統,基於“開源”許可釋出。阿帕奇版本2.0在大部分基於UNIX的作業系統上都能執行,像Linux、Solaris、Digital UNIX以及AIX。在UNIX/POSIX系列系統上,比如Rhapsody、BeOS、以及BS2000/OSD中也能執行。甚至在AmigaOS與Windows2000上也可以執行。根據Netcraft網站的調查,網際網路中60%的網站採用Apache系統。

  Apache HTTP伺服器從1996年誕生開始就成為全球使用最為廣泛的Web伺服器,其市場佔有率遠遠超過第二名的IIS。2009年,全球超過1億個網站使用Apache。

  據Netcraft2010年8月11日的資料統計表明,全球目前已有119,664,128個網站使用Apache,目前Apache市場佔有率為54.90%,IIS為25.87%。

  Nginx

  Nginx

  Nginx是一個高效能的HTTP和反向代理伺服器,也是一個 IMAP/POP3/SMTP代理伺服器。 Nginx是由Igor Sysoev為俄羅斯訪問量第二的 Rambler.ru 站點開發的。Igor將原始碼以類BSD許可證的形式釋出。Nginx 已經因為它的穩定性、豐富的功能集、示例配置檔案和低系統資源的消耗而聞名了。

  Nginx可以在大多數類Unix作業系統上編譯執行,並有 Windows移植版。Nginx 是一個很棒的高效能Web和反向代理伺服器,它具有很多非常優越的特性:在高連線併發的情況下,Nginx是Apache伺服器不錯的替代品。在美國,Nginx是虛擬主機商人經常選擇的軟體平臺之一。它能夠支援高達50000個併發連線數的響應。Nginx 的安裝非常簡單,配置檔案非常簡潔(還能夠支援perl語法),Bug非常少。

  Lighttpd

  Nginx

  Lighttpd 是一個德國人領導的開源Web伺服器軟體,其根本目的是提供一個專門針對高效能網站,安全、快速、相容性好且靈活的web伺服器環境。它的記憶體消耗非常低、CPU佔用率低、效能好並且模組豐富。

  Lighttpd是眾多開源輕量級的Web伺服器中較為優秀的一個。支援FastCGI、CGI、Auth、輸出壓縮、 URL重寫及Alias等重要功能,而Apache之所以流行,很大程度也是因為功能豐富,在lighttpd上很多功能都有相應的實現,這一點對於Apache使用者來說非常重要,因為遷移到lighttpd就必須面對這些問題。

  Cherokee

  Cherokee

  Cherokee號稱是目前最快的Web 伺服器軟體,據說在效能上甚至比Nginx還略勝一籌。而且它還提供了一個benkmark測試來試圖證明這一點,參與比較的有Lighttpd和Nginx。

  同時,Cherokee還具有眾多模組功能支援,比如FastCGI、SCGI、PHP、CGI、TLS及SSL加密連線、虛擬主機、授權認證、實時編碼、載入均衡及與Apache相容的日誌檔案等。從功能的豐富性上來說,Cherokee可以與Apache http比肩了。高效能和圖形化的伺服器管理是Cherokee的倆大賣點。

  Appweb

  Appweb

  Appweb是一個嵌入式HTTP Web伺服器,它的主要設計思路是安全。這是直接整合到客戶的應用和裝置,便於開發和部署基於Web的應用程式和裝置。它正迅速( 要求超過3500每秒)和緊湊(從11萬),其中包括支援,伺服器端嵌入式指令碼過程中的CGI ,可載入模組,的SSL ,摘要式身份驗證,虛擬主機, Apache樣式配置,日誌記錄,單和多執行緒應用程式。它提供了大量的文件和示例。

  Appweb是完全遵循GPL軟體許可協議(GNU General Public License)的開源Web伺服器。 AppWeb Web伺服器軟體在功能上比GoAhead更加豐富和實用, 除了GoAhead已有的功能之外,還有如下特點: 支援伺服器端JavaScript指令碼。

六款小巧的HTTP Server[C語言]

1、micro_httpd - really small HTTP server
特點:
    支援安全的 .. 上級目錄過濾
    支援通用的MIME型別
    支援簡單的目錄
    支援目錄列表
    支援使用 index.html 作為首頁
    Trailing-slash redirection
    程式總共程式碼才200多行
這個httpd適合學習簡單的Web Server編寫學習,因為它只有一個簡單的框架,只能夠處理簡單的靜態頁,可以考慮用來放靜態頁。
官方地址:http://www.acme.com/software/micro_httpd/
下載地址:http://www.acme.com/software/micro_httpd/micro_httpd_12dec2005.tar.gz

2、mini_httpd - small HTTP server 
特點:
    支援GET、HEAD、POST方法
    支援CGI功能
    支援基本的驗證功能
    支援安全 .. 上級目錄功能
    支援通用的MIME型別
    支援目錄列表功能
    支援使用 index.html, index.htm, index.cgi 作為首頁
    支援多個根目錄的虛擬主機
    支援標準日誌記錄
    支援自定義錯誤頁
    Trailing-slash redirection
mini_httpd 也是相對比較適合學習使用,大體實現了一個Web Server的功能,支援靜態頁和CGI,能夠用來放置一些個人簡單的東西,不適宜投入生產使用。
官方地址:http://www.acme.com/software/thttpd/
下載地址:http://www.acme.com/software/mini_httpd/mini_httpd-1.19.tar.gz

3、thttpd - tiny/turbo/throttling HTTP server 
thttpd中是一個簡單,小型,輕便,快速和安全的http伺服器:
簡單:它能夠支援HTTP/1.1協議標準,或者超過了最低水平
小巧:它具有非常少的執行時間,因為它不fork子程序來接受新請求,並且非常謹慎的分配記憶體(效能對比表:http://www.acme.com/software/thttpd/benchmarks.html)
便攜:它能夠在大部分的類Unix系統上執行,包括FreeBSD, SunOS 4, Solaris 2, BSD/OS, Linux, OSF等等
快速:它的速度要超過主流的Web伺服器(Apache, NCSA, Netscape),在高負載情況下,它要快的多
安全:它努力的保護主機不受到攻擊,不中斷伺服器

thttpd 類似於lighttpd,對於併發請求不使用fork()來派生子程序處理,而是採用多路複用(Multiplex)技術來實現。因此效能很好。同時它還有一個特點就是基於URL的檔案流量限制,這對於下載的流量控制而言是非常方便的。象Apache就必須使用外掛實現,效率較thttpd低。
thttpd跟lighttpd類似,適合靜態資源類的服務,比如圖片、資原始檔、靜態HTML等等的應用,效能應該比較好,同時也適合簡單的CGI應用的場合。
官方地址:http://www.acme.com/software/thttpd/
下載地址:http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz

4、lighttpd - light footprint + httpd = LightTPD 
Lighttpd是一個德國人領導的開源軟體,其根本的目的是提供一個專門針對高效能網站,安全、快速、相容性好並且靈活的web server環境。具有非常低的記憶體開銷,cpu佔用率低,效能好,以及豐富的模組等特點。
lighttpd 是眾多OpenSource輕量級的web server中較為優秀的一個。支援FastCGI, CGI, Auth, 輸出壓縮(output compress), URL重寫, Alias等重要功能,而Apache之所以流行,很大程度也是因為功能豐富,在lighttpd上很多功能都有相應的實現了,這點對於apache的使用者是非常重要的,因為遷移到lighttpd就必須面對這些問題。
實用起來lighttpd確實非常不錯,apache主要的問題是密集併發下,不斷的fork()和切換,以及較高(相對於 lighttpd而言)的記憶體佔用,使系統的資源幾盡枯竭。而lighttpd採用了Multiplex技術,程式碼經過優化,體積非常小,資源佔用很低,而且反應速度相當快。
利用apache的rewrite技術,將繁重的cgi/fastcgi任務交給lighttpd來完成,充分利用兩者的優點,現在那臺伺服器的負載下降了一個數量級,而且反應速度也提高了一個甚至是2個數量級!
lighttpd 適合靜態資源類的服務,比如圖片、資原始檔、靜態HTML等等的應用,效能應該比較好,同時也適合簡單的CGI應用的場合。

官方地址:http://www.lighttpd.NET/
下載地址:http://www.lighttpd.Net/download/lighttpd-1.4.16.tar.gz

5、SHTTPD - Simple HTTPD
Shttpd是另一個輕量級的web server,具有比thttpd更豐富的功能特性,支援CGI, SSL, cookie, MD5認證, 還能嵌入(embedded)到現有的軟體裡。最有意思的是不需要配置檔案!由於shttpd可以嵌入其他軟體,因此可以非常容易的開發嵌入式系統的web server,官方網站上稱shttpd如果使用uclibc/dielibc(libc的簡化子集)則開銷將非常非常低。

特點:
    小巧、快速、不膨脹、無需安裝、簡單的40KB的exe檔案,隨意執行
    支援GET, POST, HEAD, PUT, DELETE 等方法
    支援CGI, SSL, SSI, MD5驗證, resumed download, aliases, inetd模式執行
    標準日誌格式
    非常簡單整潔的嵌入式API
    dietlibc friendly. NOT that friendly to the uClibc (*)
    容易定製執行在任意平臺:Windows, QNX, RTEMS, UNIX (*BSD, Solaris, Linux)
由於shttpd可以輕鬆嵌入其他程式裡,因此shttpd是較為理想的web server開發原形,開發人員可以基於shttpd開發出自己的webserver!
官方網站:http://shttpd.sourceforge.net/
下載地址:http://jaist.dl.sourceforge.net/sourceforge/shttpd/shttpd-1.38.tar.gz

6、tinyhttpd

tinyhttpd is a very simple webserver. It is not for production use; instead it is primarily for a learning tool for persons investigating the http protocol and UNIX system calls.

Despite its simple nature, tinyhttpd supports threading and CGI scripts! For more information, see the accompanying README file and the code itself.

tinyhttpd is tested on Sparc Solaris and will probably not run on other operating systems as-is. However, commenting out the line that does threading may be all that is required to port it. I would like to autoconfiscate tinyhttpd at some point in time to help make it more portable.

There is no downloadable release of tinyhttpd, yet. Until then, you can get it by anonymous CVS.

The real homepage for tinyhttpd is the project page

【譯】幾種Web伺服器比較

注意到有這款伺服器nginx。沒聽過,一查有了下文。其中有一個還是聽過的。對照翻譯了下文。

Apache and IIS are the most common web servers in use today, but they are far from alone. There is a huge amount of web server software out there, both free and commercial.

到目前,Apache和IIS是用的最為普遍的Web伺服器,但是它們太過單一,在此之外這裡還有許多Web伺服器軟體,或是免費的或是商業的。

In this article we present four popular alternative web servers: LighttpdNginxLiteSpeed and Zeus. The first two are free and open source while the other two are commercial, closed-source alternatives. What they all have in common is that they focus on high performance.

本文我們介紹四種最受歡迎的Web伺服器: LighttpdNginxLiteSpeed 和 Zeus。 前兩個都是免費且開源的,而另兩種都是商業的,閉源的。它們的共同點在於都著重於高效能上。

We will also take a look at how many websites are actually using these web servers.

我們看看有多少網站實際上在使用它們。

But first a brief presentation of each of one:

首先一個簡短的介紹其中之一:

Lighttpd
  • Brief info: Pronounced “Lighty”, Lighttpd is as the name implies a small, lightweight web server which has a low memory footprint and light CPU load. Lighttpd is a good alternative to serve static content but it has also gained recognition in the Ruby on Rails and PHP communities.

    Lighttpd 的名稱暗示小,輕量級web伺服器,佔用記憶體小且cpu負荷低。Lighttpd 是服務於靜態內容的不錯選擇。然而它更被公認為是用在Ruby 和 PHP 上。
  • Used by: Wikimedia (Wikipedia), Sourceforge, YouTube, The Pirate Bay, Meebo, Imageshack, Sendspace, Mininova.
  • Cost: Free
  • Open Source: Yes
  • OS platforms: Linux, freeBSD, Solaris, MacOS X, Windows (under Cygwin)
Nginx
  • Brief info: Pronounced “engine X”, Nginx is a lightweight web server and reverse proxy. originally written by Igor Sysoev for Rambler.ru (Russia’s second most visited website). Nginx is known for stability and simple configuration in addition to its low resource consumption. It can also act as an IMAP/POP3 proxy. 

    Nginx 是一款輕量級web伺服器和反向代理。最初由Igor Sysoev 編寫。它的出名在於其穩定性和簡單的配置,除此之外低資源消耗。 還有它可以作為IMAP/POP3協議。
  • Used by: Yellow Pages, Hulu, Zimbra, the Friends for Sale Facebook app, Rambler, and it also seems that Wordpress.com just started using it instead of LiteSpeed.
  • Cost: Free
  • Open Source: Yes
  • OS platforms: Linux, FreeBSD, Solaris, MacOS X
LiteSpeed
  • Brief info: LiteSpeed is a commercial web server designed specifically for large websites. One of LiteSpeed’s advantages is that it can read Apache configurations directly which makes it easy to integrate with existing products to replace Apache. The server is lightweight and as the name implies very fast. 

    LiteSpeed 一種被特別設計用作大型網站的商業web伺服器。 其中一個優勢就是它能直接讀取Apache 的配置資訊。並輕易將它現有的產品結合在一起來代替Apache 。這種伺服器是輕量級的就如它的名字暗示出非常快。
  • Used by: Wordpress (until recently at least, but now Wordpress.com appears to be using nginx), Twitter, GigaOm, Bravenet.
  • Cost: Free to $1,299 depending on the edition.
  • Open Source: No
  • OS platforms: Linux, FreeBSD, Solaris, MacOS X
Zeus
  • Brief info: Zeus web server is a high performance web server. It has received PC Magazine Editors’ Choice award and also the eWeek/PC Magazine Innovation in Infrastructure award. Zeus is a highly flexible enterprise product. 

    Zeus web server 是一個高效能的web伺服器。它曾被PC Magazine Editors’ Choice 授過獎並且eWeek/PC Magazine Innovation 也授予過它獎項。Zeus 是一種高度靈活的企業產品。
  • Used by: Sony, Telefónica, Virgin media, phpBB.
  • Cost: $1,700 up to two physical CPUs; $850 per additional CPU.
  • Open Source: No
  • OS platforms: Linux, FreeBSD, Solaris, HP-UX

How many websites are using these web servers?

According to Netcraft, Lighttpd is currently the most common of these four web servers. On April 1, the numbers of websites for each were as follows:
有多少網站在使用它們?
根據Netcraft統計,Lighttpd 是當前這四種伺服器中最普遍的。在4月1日統計到的網站數字。

Lighttpd: 1,495,308
Nginx: 1,018,503
LiteSpeed: 668,030
Zeus: 420,477

These positions were not always the same, though. As you can see by the following graph, which shows the numbers from January 2006 to April 2008, the situation has changed significantly over time.

然而這個形勢並不一直是一樣的。通過下圖你可以看到從2006年1月到2008年4月,形勢隨著時間而改變著。


The graph is based on data from Netcraft (their web server survey archives).

The huge leap for Lighttpd in January-March of 2007 is most likely due to one or more web hosting or domain registration companies switching over to Lighttpd either for their regular pages, or for parked pages, or both. If anyone knows what happened there in more detail, please feel free to let us know in the comments.

2007年1月到3月,很可能歸咎於一個或多個web服務商或域名註冊公司轉變使用Lighttpd 。發生了什麼如果有人知道的更詳細些……

Interestingly, the number of servers using the Zeus web server has remained quite constant over the last two years, and even decreased a little. That said, it is mainly an enterprise solution, so this is perhaps not so surprising.

非常有趣的是,過去兩年使用Zeus 作為伺服器的數量維持在一個非常恆定的狀態。而且減少了一點點。可以說,它主要是針對企業解決方案。所以從這點上是不值得驚訝的。

The two web servers that have been growing the fastest lately are Nginx and LiteSpeed. Nginx recently passed the one-million-websites mark.

Nginx 和 LiteSpeed 這兩種伺服器增長速度很快。近來Nginx 已經超過了一百萬個站點

These numbers of course still pale next to Apache’s roughly 83 million websites, but there is no doubt that these alternative web servers are gaining in popularity. Who knows, one of them may be just right for you?

當然這些數字對於Apache的大概8300萬來說不值一提。但仍無置疑的是這些可供選擇的伺服器越來越受歡迎。有誰知道,其中之一很可能是非常適合你的?