Web设计十年回顾

Posted by 冰河 at 10:41 No Responses » 15,775 Views
052010

转眼进入了2010年,一个新的十年又开始了,但是我们是怎么一步步走到这里的呢? 在这篇文章里,我们将会回顾下在上个十年里每年推动web设计发展的重大事件,大家数一数对自己有造成影响的技术事件,我敢打赌用十个手指来数是不够的。

2000

网络行业艰难起步了,在最初的二到三年,越来越多的企业进军网上贸易,互联网泡沫也越来越大。最终,在2000年过去不到半年,网络泡沫破灭了,很多网络公司也随之破产。

当然其中也有获得成功的企业,一个成功的例子就是一个简单的论坛公告栏项目。开源论坛软件phpBB最早是在当年7月向公众发布的,目前,它是最流行的免费论坛系统软件。

2001

B2,在GPL框架下创建的最原始博客系统。如果你有看过它的最初版本,你会发现其后续版本WordPress仍然保留了它的一些特征。

五月份,W3C组织提出了CSS 3标准。首次基于CSS3标准的项目在1998年开始展开,十年多过去了,这项标准仍然不断地发展完善中。

八月份,可以说是十年里最让人痛恨的应用,IE6,推出了。至少从现在开始我们可以跟它说再见了

2002

这一年,乔纳森艾布拉姆 (Jonathan Abrams)创建了Friendster。这是一个非常流行的社交网站,被称为之后无数社交站点,包括MySpace、Facebook的先驱。

RSS 2.0 规范于那一年九月份推出。这个格式的内容可以以独立的格式与大家共享,用户可以选择任何方式来控制内容。

2003

2003年,大卫海涅迈尔(David Heinemeier)开始研究Ruby on Rails。 现在这个开源的web应用框架已经非常普及,PHP与Ruby on Rails之间的争论也异常激烈。

b2诞生后的两年里,事情并没有进展很顺利。核心的开发人员消失了也没有更新了。马特·穆伦维格(Matt Mullenweg)带着他的想法闯入它的分支开发中,接着WordPress就诞生了。

六月份,杰弗里泽尔德曼(Jeffrey Zeldman)发表了《Web标准设计》一书 (现在到第三版)。这本书呼吁企业应该使用标准化编码的,里头有足够信服理由,它帮助web设计行业改型换面。

A List Apart定期发布一些非常出色的文章。2003年最好的一个例子就是帕特里克格里菲思(Patrick Griffiths)发表的Suckerfish Dropdowns文章,这些文章讲述如何创建一个轻量级、符合标准的、可访问的下拉菜单。在DHTML流行的时代,此乃天赐之物,后来 Suckerfish之子对其进行改进。

八月份,几名eUniverse 的员工(其中包括世界著名的Tom)聚集在一起,来源于Friendster的灵感创建了MySpace网站。 早些时候,eUniverse庞大的用户群给了这个网站很大的优势,不过后来竞争对手也马上出现了。

十月份,哈佛大学的一名寂寞学生 创立了Facemash ,这个站点上人们对比两个学生的照片,看谁更好看。虽然很快就面临关闭了,不过这对后来人都是一个借鉴…

2004

一月份,一些活跃的学生借鉴Facemash,创建了Facebook, 现在是Alexa世界排名第二的网站

同样也是在2004年年初,37Signals公司推出项目管理工具 Basecamp。 37Signals公司和他们的产品从那以后就成了简单设计的典范。

愚人节的时候,谷歌公司多年来都是以戏弄人出名的。2004年的愚人节,他们宣布推出1G容量的免费邮箱服务Gmail,人们更相信这是一个玩笑,怎么可能呢?Hotmail才只有两兆的容量…

与此相关的还有一项技术,Gmail是第一个主要应用使用AJAX 的例子。从那以后AJAX技术才不断地被无数网站所采用。

接近那年年底,“Phoenix项目”1.0版推出,就是后来改名为Firefox大家都非常熟悉的浏览器。

2005

四月份,迈克戴维森(Mike Davidson)推出了sIFR ,这样通过Flash丰富了网络排版。

同样也是在四月份,Adobe公司以34亿美元的高价位收购Macromedia。这样,行业标准工具,如Fireworks、Dreamweaver和 Flash都纳入到 Adobe Creative Suites套件中。

十月份,Safari成为第一个通过 Acid2 测试的浏览器。Acid测试是用于测试浏览器对网页标准的支持,以实现所有的浏览器都使用相同的标准。

12月份,An Event Apart首次在费城揭幕。这是业界顶尖的设计大会,那以后,这样的大会总共召开了17次。2010年将安排四次会议。

2006

一月份,Opera Mini全球发行。它是一款手机浏览器,号称是世界最流行的手机浏览器。

同年一月份,John Resig在纽约城Barcamp会议上发布 JQuery 。从那以后,JQuery成为了迄今为止最为流行的JavaScript 库。

二月份,雅虎公司推出了YUI2,这个框架使得网络应用开发更加简单。虽然2009年9月份推出了YUI3 ,但是YUI2 仍然十分受欢迎。

三月份,杰克多尔西(Jack Dorsey)发表第一个Tweet。一直到这个十年的最后,“twttr project”才最后达到赢利。

十月份,谷歌以16.5亿美元收购YouTube。这次事件激发了很多人网络创业的激情。

1997 年微软FrontPage首次发布,除了其基于表的可怕的布局外,FrontPage的扩展功能的使用需要在微软服务器上运行也是一场噩梦。2006年12月,微软公司终于停止该产品。

2007

2007年,MovableType,WordPress的专门竞争对手,由于WordPress强势的发展势头将其远远甩在了后头。为了尽快赶上WordPress,他们发布了 MovableType GPL版本,但是 限制仍然远比WordPress多。

2007年6月初,Adobe公司发布了 Adobe AIR。在这种运行环境下,开发人员可以使用各种web技术如AJAX 、Flash来创建桌面应用程序,这些程序可以在任何平台上运行 (Windows, Mac, Linux)。

2007年6月,史蒂夫乔布斯推出了一款颇有意思的玩意iPhone

11月份,亚马逊公司推出了一个新的电子书阅读器,Kindle。作为互联网开发人员,我们习惯于阅读各种媒介上提供的内容。Kindle和其他电子阅读器引起了很多人的关心。

2008

三月份,Nathan Smith 推出了960 网格系统 。使用这个CSS 框架,你可以单独使用HTML 快速设计模拟网络布局。

自从2004年发布Firefox的最初版本之后,它不停地在稳步发展。6月17日这天被称为“下载日”就是最好的见证。Firefox 3在一天二十四小时内下载次数超过八百万次,创造了世界纪录。

这时,iPhone发布才一年,却已经受到很多人的欢迎。随着七月份iphone应用程序商店的推出,再一次稳固了Iphone未来的主导地位。

在那年秋季,HTC Dream成为第一个可在谷歌Android 操作系统上运行的机器。被称为iPhone 杀手,HTC和Android 手机可谓名副其实了,也确实获得了不少的市场份额。

12月份,Google Chrome浏览器公开发售。这个网页浏览器是基于WebKit并且讲究速度优化为第一而开发的。

2009

BuddyPress基于WordPress MU的社交网站的扩展, 最早在4月份发布。它有很强的发展后劲,现在已经包含了很多功能。

6月份,微软公司的Bing搜索正式投入运行。微软公司在搜索行业原本开始走下坡路,但是自从必应和其对应的市场策略出来后,终于出现了一些增长势头。

同样也是在6月份,Alexis Sellier和 Dmitry Fadeyev共同推出 Less CSS 。这样CSS代码可以有各种变量、操作和嵌套规则,最后再将其编入到正规的CSS框架中。

7月份,W3C确认年底XHTML 2团队的特许执照到期将不会更新。这样更多的人力和资源就朝向HTML5的开发了。

10月份,雅虎公司关闭其Geocities服务。 Geocities是大多数人向互联网发布内容的首次尝试。自从雅虎公司90年代后期的发展以来,网络出版发展取得了非常明显的效果。

结束语

回顾过去的十年,发生了很多很多事情。我相信在1999年没有人会预测到现在的样子。下一个十年,2020年又会是如何的呢?

原文:Decade in Web Design

1.概述
   http://video6.sjtu.edu.cn(以 下简称video6网站)是上海交通大学网络信息中心在下一代互联网CERNET2上建立的视频服务网站,通过IPv6网络向全球提供服务。目前主要提供 几十个电视台、电台的网上直播,以及测试性提供少量视频点播内容。该网站广受用户好评,是目前国内IPv6网络上流量最大的网站。考虑到当前IPv6网络 资源较少,而该站点电视直播资源丰富,用户群体很大,能够在一定程度上反映出IPv6用户的分布和使用状况。因此我们决定对该站点的Web访问日志进行分 析。我们希望通过初步分析达到以下目的:
   了解网站目前的访问情况。这样有助于我们更全面掌握服务器的使用状况,合理配置视频服务的软硬件系统,更好的为用户提供服务。
   分析目前IPv6用户的分布状况和接入方式。在当前国内IPv6普及率不高的情况下希望得到用户比较集中的地区分布并进行初步统计分析。
   原始日志数据
   我们在video6网站的Web服务器端启动了日志记录功能,日志记录的格式为: date time s-sitename cs-method cs-uri-stem cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes,收集了从 2008年2月26日到2008年3月27日共一个月的日志。这份日志一共涉及到 129,236个不同的IPv6地址,包含2,930,961条原始记录。
   我们依次采用下列手段过滤了一些对于此次统计分析没有意义的访问记录,包括:
   1.由于服务器是双栈的,日志中存在来自Baiduspider等搜索引擎和网络扫描产生的少量IPv4地址的访问。因为这些数据不能反映IPv6用户 的真实访问情况,我们首先将这些数据剔除在分析数据集之外。这些记录一共 364条,占所有原始记录的0.012%。
   2.考虑到不是所有用户都会访问video6网站的论坛和网速带宽测试栏目,而这种访问可能会使一个用户产生较多的日志记录,对后来的分析产生干扰。我们也过滤了用户访问这些内容的日志记录。这些记录一共 281,189条,占所有原始记录的9.59%。
   3.同样是为了避免干扰分析,我们过滤了扩展名是 .zip,.exe 等文件的下载记录。这些记录有20,092条,占所有原始记录的0.686%。
   4.我们发现日志里对部分目录的GET请求,显示的IPv6地址会以%0结尾,这可能和Web服务器的处理有关。由于这部分IPv6地址在请求其他文件 时已经有所反映,并不会影响我们此次的分析,所以可以忽略。这些记录有1,818,846条,占所有原始记录的62.1%。
   经过这些过滤,最终剩余810,470条访问记录作为此次分析样本,占所有原始记录的27.7%,涉及到 129,236个不同IPv6地址。
   用户IPv6地址来源和地区分布
   根据我们目前所掌握的信息,用户的IPv6地址主要来源于4种途径。
ISATAP隧道方式
    ISATAP隧道方式获取的IPv6地址格式为:Prefix(64bit):0:5efe:IPv4ADDR(IPv4ADDR即隧道端点的IPv4源 地址,常见形式为a.b.c.d),所以在日志记录中我们很容易发现哪些用户使用ISATAP方式接入。一般说来,如果用户的IPv4地址不发生变化,那 么他通过ISATAP隧道方式获取的IPv6地址也不会发生变化。我们经过统计发现存在有34个ISATAP服务器地址,共出现了10,056个不同的 IPv6地址,占分析样本所有地址的7.78%。
表1. ISATAP服务器活跃程度排名Top20
排序.   Prefix(64bit):0:5efe   提供者    IPv6地址数  
1   2001:da8:1005:1111:0:5efe   南京农业大学   2223  
2   2001:da8:21c:6ff:0:5efe   中国人民大学   1669  
3   2001:da8:207:1:0:5efe   北京师范大学   1459  
4   2001:250:2009:400c:0:5efe   四川西华大学   1004  
5   2001:da8:c803:85:0:5efe   西南大学   984  
6   2001:da8:200:900e:0:5efe   清华大学   472  
7   2001:da8:c800:b:0:5efe   重庆大学   403  
8   2001:da8:c003:3:0:5efe   西北师范大学   385  
9   2001:da8:8000:3:0:5efe   上海交通大学   334  
10   2001:250:5008:2000:0:5efe   江苏工业学院   324  
11   2001:da8:205:ffff:0:5efe   北京交通大学   204  
12   2001:da8:224:a0d2:0:5efe   中国政法大学   180  
13   2001:da8:224:a0ce:0:5efe   中国政法大学   94  
14   2001:da8:211:2:0:5efe   北京林业大学   89  
15   2001:da8:7007:ffff:0:5efe   石油大学   44  
16   2001:da8:224:a021:0:5efe   中国政法大学   34  
17   2001:da8:224:a037:0:5efe   中国政法大学   26  
18   2001:da8:b8:66:0:5efe   同济大学   26  
19   2001:da8:7007:fffe:0:5efe   石油大学   25  
20   2001:da8:e800:2:0:5efe   厦门大学   15  

    从表1中我们可以看出几乎所有ISATAP隧道接入方式都由国内大学或学院提供。分析对应的IPv4地址可以看出这些主要面向校内用户(出现的IPv4地 址是内部地址或校内地址),但是也有部分允许校外接入使用。由于在部分学校存在DHCP自动获取IPv4地址的现象,这样同一个用户在不同时间访问 video6网站,日志记录到的可能是不同的IPv6地址。这会给我们的分析带来一定程度的偏差,所以并不能说出现地址多的学校用户数一定比地址少的用户 多,这仅仅是一个趋势上的大致排名。Top20的ISATAP服务器出现过的IPv6地址总计9994,占全部 ISATAP隧道接入的 99.4%。

6to4隧道方式
    6to4隧道方式获取的IPv6地址格式为:2002:IPv4ADDR::/48 (IPv4ADDR即隧道端点的IPv4源地址,常见形式为xxxx:xxxx,是由32位IPv4源地址a.b.c.d转化而来的32位16进制表 示)。我们统计下来出现过2,815个6to4隧道IPv6地址,占分析样本所有地址的2.2%。
我们编写程序对这些地址进行了转换,得到了对应的2773个IPv4地址,再使用网上流行的纯真(CZ88)IP地址库对这些IPv4地址全部做了地域反查然后归类分析,得到结果如下表:

表2. 6to4服务活跃程度排名 Top10
排序   来源   IPv4地址数  
1   山东大学   1244  
2   重庆大学   366  
3   中科院   345  
4   兰州大学   340  
5   网通   120  
6   电信   101  
7   上海交通大学   54  
8   教育网直通车   29  
9   江苏工业学院   11  
10   东北大学   9  

    从表2中我们可以看出大学和科研院所还是使用6to4隧道的主力。需要特别说明的是,6to4并非是IPv6的主流接入方式,很多用户可能只是在安装了 IPv6协议以后,从微软的隧道服务器自动获取到的IPv6地址。在这张表里排名靠前的学校,安装IPv6协议的用户数相对较多。Top10的6to4活 跃用户总计2619,占全部使用6to4隧道接入方式的94.4%。

支持IPv6的Proxy
    通过对同一个IPv6地址的出现次数以及用户浏览器代理的关联分析,我们发现了唯一的一个IPv6地址(2001:638:902:1::11),这个地 址在所有的日志中出现了30,420次,占3.75%。通过分析来自这个IP的日志,得到了541个不同的User-Agent。如果操作系统和使用的浏 览器程序不变,一般用户访问时日志记录的User-Agent是不变的。在我们这次分析的包含129,236个IPv6地址的日志样本中,不重复的 User-Agent也只有3292个。那么说明最少有541个用户使用了这个代理服务器(由于不同用户的访问User-Agent信息可能相同,所以实 际数目可能远远超过这个数字)来访问video6网站。对这个IPv6地址反解出来的域名为 proxy.ipv6.uni-leipzig.de,是由德国莱比锡大学提供的IPv6 http 和 ftp proxy,这也是在IPv6网络上广泛使用的一个知名代理服务器。

Native IPv6方式
    剩下来的IPv6地址我们认为是Native IPv6接入。这些IPv6地址有116,364个,占分析样本所有地址的90%。我们将这些IPv6地址和对应学校或单位做了区域映射并分类统计,最终得到下表:
表3. Native IP 活跃地区排行Top25
排序   Prefix(48bit):   使用者    活跃IP  
1   2001:CC0:2020   中科院研究生院   24318  
2   2001:DA8:7000   山东大学   23479  
3   2001:DA8:224   中国政法大学   21679  
4   2001:DA8:216   北京工业大学   15622  
5   2001:DA8:7001   山东大学齐鲁软件学院   6368  
6   2001:DA8:215   北京邮电大学   4078  
7   2001:DA8:C000   兰州大学   2416  
8   2001:DA8:200   清华大学   2262  
9   2001:250:217   中国传媒大学   2007  
10   2001:DA8:D800   中国科技大学   1644  
11   2001:DA8:211   北京林业大学   1385  
12   2001:250:1804   华南理工大学   1378  
13   2001:DA8:E000   浙江大学   1210  
14   2001:DA8:207   北京师范大学   1039  
15   2001:DA8:7005   济南大学    911  
16   2001:250:1401   兰州理工大学   685  
17   2001:256:100   3Tnet网   591  
18   2001:DA8:201   北京大学   389  
19   2001:DA8:C803   西南大学   380  
20   2001:250:2009   四川西华大学   332  
21   2001:250:1999   华南理工大学   311  
23   2001:DA8:1002   东南大学   281  
24   2001:DA8:21C   中国人民大学   277  
25   2001:CC0:201C   中科院   206  

   可以看出,高校和科研单位是Native IPv6的主要使用者。各学校使用普及情况非常不平衡,Top25的学校或单位使用的IPv6地址数为113,248,占全部Native IPv6接入的97.3%,其他高校IPv6的普及推广情况可想而知,不容乐观。我们通常公认的校园网基础建设比较好的学校,IPv6的使用情况也并没有 想象的那么好。但是在部分地区,IPv6还是有相当程度的使用量,这些都值得我们关注和思考。
   有一点需要特别指出,出于安全性考虑, Windows操作系统里使用自动配置获得的Native IPv6地址会随着时间的增加而自动改变,因此同一用户在不同时间段内访问video6网站,日志里记录的用户IPv6地址可能是不同的。由于我们暂时无 法分离出这些重复用户,这给我们的分析带来一定程度的误差。在表3排名靠前的学校里,实际使用的用户并没有列出的IP地址那么多,而只是从一个侧面表明其 使用人数和使用频率相对较高。
   用户浏览器和操作系统分析
   由于使用IPv6代理的用户无法精确统计其信息,我们过滤了来自Proxy的所有日志记录。因为用户可能会多次访问video6网站,在日志里就会留下 不同时段来自同一个用户的访问纪录。为了避免重复统计,因此在下面的分析中,我们认为一个IPv6地址仅代表一个用户,以下内容分析样本中一个IPv6地 址只会出现一次。虽然IPv6网络里不存在NAT等因素引起一个IP对应多个用户的现象,但是实际情况存在有一个用户对应多个IPv6地址的情况,所以下 面的分析不可避免的存在有一些误差。.
   4.1 客户端浏览器的统计
   我们首先对客户端浏览器做了统计,其分布如表4。
表 4. 浏览器使用比例图
浏览器   独立 IP 数    百分比  
IE 6.0   77986   59.1%  
IE 7.0   45903   34.8%  
Firefox 2.0   6227   4.7%  
Opera    980   0.74%  
Firefox 3.0   471   0.36%  
Firefox 1.0/1.5   271   0.21%  
IE 8.0   89   0.07%  
Safari   58   0.04%  
  
   可以看出绝大部分用户(94.6%)都是使用IE或其内核浏览器来访问video6网站,这也意味着大部分人都选择使用Windows平台。
     4.2 客户端操作系统的统计
     从日志的User-Agent信息里可以获取用户的操作系统信息,其分布见下表:
表5. 操作系统分布比例图
操作系统    独立 IP 数    百分比   
Windows XP    119897   92.7%  
Windows Vista    9013   6.97%  
Linux    186   0.14%  
Windows 2003    154   0.12%  
Windows 2000    61   0.05%  
Macintosh    12   0.009%  
  
   可以看出,由于Windows XP对IPv6的良好支持,大部分用户都选择了使用这种操作系统来访问video6网站,Vista由于内置了IPv6协议,也有相当部分的用户使用,选择其他操作系统的用户非常少。  
   总结
    十年前,中国教育和科研计算机网就已加入IPv6试验网6 Bone,今年CERNET2的建设也即将步入第五个年头。管中窥豹,可见一斑,从我们这份简单的日志分析报告来看,国内大部分地区IPv6推广普及工作 还任重道远,缺少应用支撑的IPv6网络难以得到广大网络管理者和普通用户的关注。随着今年CERNET2驻地网建设项目的实施,接入院校和单位会越来越 多,但网络服务的投入却远远跟不上这张网的建设速度。“Content is King”,如果所有人都能深刻理解到这一点,IPv6未来真正融入我们的生活也许才不是一个梦想。

262010

六维空间(东北大学IPv6 BT下载站,http://bt.neu6.edu.cn)是由东北大学网络中心开发维护,基于纯IPv6协议访问,提供P2P资源索引类的网站,六维空间这个站名正是由“v6”的谐音变换而来。目前六维空间注册用户数33000多人,网站最高在线1700多人,平均日发帖量20000余篇,平均在线种子数40000左右。

六维空间的前世今生

六维空间的前身是东北大学BT下载站,基于IPv4协议为校园网用户提供校内BT下载服务。使用Linux操作系统,PHP语言编写种子索引页,用MySQL数据库来保存种子相关信息,Apache作为索引页的Web服务器,Tracker服务器端软件使用的Python语言编写的BitTorrent。

2008年初,鉴于当前IPv6网络使用的优惠政策,同时为了提高东北大学校园网IPv6的使用率,我们计划将原面向IPv4用户服务的东北大学BT下载站迁移至IPv6网络,建立为IPv6用户服务的东北大学IPv6 BT下载站。

2008年9月,东北大学IPv6 BT下载站开站,东北大学BT下载站成功从IPv4网络迁移至IPv6网络,开始为IPv6用户提供BT下载服务。

2009年2月,由于网站发展的需要,东北大学IPv6 BT下载站更名为六维空间 – 东北大学IPv6 BT下载站,简称六维空间。

迁移中的问题

东北大学BT下载站迁移前后网站架构图如图2所示,左边是IPv4 BT下载站的架构,右边是IPv6 BT下载站的架构。

图2 东北大学BT下载站迁移前后网站架构

在之前的网站架构中,我们使用Apache作为Web服务器发布资源索引,并使Tracker服务器直接对外提供服务。在新的架构中,我们将Web服务器更换为轻量级的Lighttpd,以FastCGI方式运行PHP,使服务器更节省资源,支持更高的负载。同时在原Tracker服务器前端放置Nginx作为Tracker服务器的反向代理,便于今后为Tracker服务器做水平分布扩展。

1.实现Lighttpd支持IPv6
Lighttpd是一个专门为高性能网站提供安全、快速、兼容性好并且灵活的Web Server环境。具有非常低的内存开销,CPU占用率低,效能好,以及丰富的模块等特点。默认情况下Lighttpd监听在0.0.0.0:80,也就是说只监听IPv4端口,不监听IPv6的端口Lighttpd的配置文件lighttpd/lighttpd.conf默认并不提供IPv6配置选项。
我们可以通过修改配置文件,增加IPv6相关配置以实现Lighttpd支持IPv6,打开Lighttpd的配置文件lighttpd/lighttpd.conf,在适当的位置加入一条配置语句:server.use-ipv6 = “enable”。之后重新启动Lighttpd,会发现他现在已经监听在:::80了,说明支持IPv6的访问了。

2.使用Nginx支持IPv6
Nginx是一个轻量级的HTTP服务器,是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP代理服务器。在0.7.36之前,Nginx还不支持监听IPv6端口,在0.7.36版本里,Nginx的HTTP模块加入了IPv6的支持,开始支持监听IPv6端口,允许IPv6的访问。
使Nginx支持IPv6不如Lighttpd那么方便,需要重新编译Nginx的代码,并在编译配置选项中加入:“–with-ipv6”以支持IPv6。编译安装完成后,还需将原配置文件listen部分配置为IPv6的地址:“listen [::]:6969;”。然后重新启动Nginx。

3.修改索引页与Tracker代码
IPv6的地址与IPv4的地址相比,在长度上,以及地址格式上都不一样,虽然IP索引页与Tracker代码属于应用层的范围,不属于网络层,但其中许多代码写法与IPv4地址有关。
例如代码中的用户来源地址合法性验证、安全审核、日志记录等涉及到IPv4地址格式的代码,需一一修改,使他们支持IPv6的地址长度与地址格式。

4.使用uTorrent作为BT客户端
由于目前在IPv4网络中流行的迅雷、BitComet、FlashGet等下载软件不支持IPv6,因此我们建议用户使用支持IPv6网络的uTorrent作为BT下载客户端。

了解用户行为

1.用户来源分析
通过对用户来源地区来源进行统计,得到图3的结果。

图3 用户来源地区统计

可以看到北京地区的IPv6用户占将近一半。并且几乎没有用户是通过搜索引擎搜索访问到六维空间的,可能与当前搜索引擎的机器人不支持IPv6网络有关。因此对于IPv6网络服务的推广使用SEO是没有什么效果的,还需要依靠其他的宣传手段。

2.操作系统使用统计
由于Windows Vista系统可以直接支持IPv6,而Windows XP、Windows 2000等操作系统需要手动安装IPv6协议,因此我们也针对用户所使用的操作系统做了一个统计。如图4。

图4 用户使用的操作系统统计

可以看到Windows XP用户还是占据了很大比例,因此如何能让Windows XP用户更方便地安装IPv6协议,也是我们在推广IPv6网络过程中应该考虑的一项内容。

3.用户行为分析
通过分析用户访问的页面,我们观察到用户使用六维空间主要是分享资源,特别是电影,电视等媒体资源,由于IPv6网络当前的优惠政策,使其较IPv4网络在P2P共享电影,电视等媒体资源方面有很大的优势。

迁移后的思考

在东北大学IPv6 BT下载站从IPv4向IPv6迁移过程中,我们并没有让Tracker服务器直接对外提供服务,而是使用Nginx作为Tracker服务器的前端反向代理服务器,使Nginx起到为Tracker服务器做负载均衡的效果。这种架构模式中,只要Nginx支持IPv6就可以,而不需要关心Tracker服务器与Nginx之间以何种通信方式通信,对用户都是透明不可见的。换句话说,Nginx与Tracker服务器之间也可以通过IPv4协议来通信。

对于目前许多成熟的、却尚未支持IPv6的IPv4应用来说,如果可以使用一些通用的Porxy程序,或者是其他一些地址转换技术,使这些IPv4下的应用迅速地迁移至IPv6网络中来,加速IPv6网络的推广。

Nginx多站点设置

Posted by 冰河 at 21:51 1 Response » 36,093 Views
十二 182009

方法一:多个.conf方法(优点是灵活,缺点就是站点比较多配置起来麻烦)

这里以配置2个站点(2个域名)为例,n 个站点可以相应增加调整,假设:

IP地址: 202.55.1.100
域名1 example1.com 放在 /www/example1
域名2 example2.com 放在 /www/example2

配置 nginx virtual hosting 的基本思路和步骤如下:

把2个站点 example1.com, example2.com 放到 nginx 可以访问的目录 /www/
给每个站点分别创建一个 nginx 配置文件 example1.com.conf,example2.com.conf, 并把配置文件放到 /etc/nginx/vhosts/
然后在 /etc/nginx.conf 里面加一句 include 把步骤2创建的配置文件全部包含进来(用 * 号)
重启 nginx

具体过程

下面是具体的配置过程:

1、在 /etc/nginx 下创建 vhosts 目录

mkdir /etc/nginx/vhosts

2、在 /etc/nginx/vhosts/ 里创建一个名字为 example1.com.conf 的文件,把以下内容拷进去

server {
        listen  80;
        server_name  example1.com www. example1.com;

        access_log  /www/access_ example1.log  main;

        location / {
            root   /www/example1.com;
            index  index.php index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

       # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ .php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /www/example1.com/$fastcgi_script_name;
            include        fastcgi_params;
        }

        location ~ /.ht {
            deny  all;
        }
}

3、在 /etc/nginx/vhosts/ 里创建一个名字为 example2.com.conf 的文件,把以下内容拷进去

server {
        listen  80;
        server_name  example2.com www. example2.com;

        access_log  /www/access_ example1.log  main;

        location / {
            root   /www/example2.com;
            index  index.php index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

       # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ .php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /www/example2.com/$fastcgi_script_name;
            include        fastcgi_params;
        }

        location ~ /.ht {
            deny  all;
        }
}

4、打开 /etc/nginix.conf 文件,在相应位置加入 include 把以上2个文件包含进来

user  nginx;
worker_processes  1;

# main server error log
error_log	/var/log/nginx/error.log ;
pid	/var/run/nginx.pid;

events {
	worker_connections  1024;
}

# main server config
http {
	include       mime.types;
	default_type  application/octet-stream;
	log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

	sendfile        on;
	#tcp_nopush     on;
    	#keepalive_timeout  0;
	keepalive_timeout  65;
	gzip  on;

	server {
        	listen         80;
        	server_name     _;
        	access_log      /var/log/nginx/access.log main;
        	server_name_in_redirect  off;
        	location / {
            		root  /usr/share/nginx/html;
            		index index.html;
        	}
	}

    # 包含所有的虚拟主机的配置文件
    include /usr/local/etc/nginx/vhosts/*;
}

5、重启 Nginx

/etc/init.d/nginx restart

方法二:动态目录方法(优点是方便,每个域名对应一个文件夹,缺点是不灵活)

这个简单的方法比起为每一个域名建立一个 vhost.conf 配置文件来讲,只需要在现有的配置文件中增加如下内容:

# Replace this port with the right one for your requirements
# 根据你的需求改变此端口
listen       80;  #could also be 1.2.3.4:80 也可以是1.2.3.4:80的形式
# Multiple hostnames seperated by spaces.  Replace these as well.
# 多个主机名可以用空格隔开,当然这个信息也是需要按照你的需求而改变的。
server_name  star.yourdomain.com *.yourdomain.com http://www.*.yourdomain.com/;
#Alternately: _ *
#或者可以使用:_ * (具体内容参见本维基其他页面)
root /PATH/TO/WEBROOT/$host;
error_page  404              http://yourdomain.com/errors/404.html;
access_log  logs/star.yourdomain.com.access.log;
location / {
root   /PATH/TO/WEBROOT/$host/;
index  index.php;
}
# serve static files directly
# 直接支持静态文件 (从配置上看来不是直接支持啊)
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log        off;
expires           30d;
}
location ~ .php$ {
# By all means use a different server for the fcgi processes if you need to
# 如果需要,你可以为不同的FCGI进程设置不同的服务信息
fastcgi_pass   127.0.0.1:YOURFCGIPORTHERE;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /PATH/TO/WEBROOT/$host/$fastcgi_script_name;
fastcgi_param  QUERY_STRING     $query_string;
fastcgi_param  REQUEST_METHOD   $request_method;
fastcgi_param  CONTENT_TYPE     $content_type;
fastcgi_param  CONTENT_LENGTH   $content_length;
fastcgi_intercept_errors on;
}
location ~ /.ht {
deny  all;
}

最后附另外一个二级域名匹配的方法

绑定域名
server_name *.abcd.com;
获取主机名
if ( $host ~* (.*).(.*).(.*))
{
set $domain $1;
}
定义目录
root html/abc/$domain/;
location /
{
root html/abcd/$domain;
index index.html index.php;

十二 182009

1,passwd文件
passwd文件存放在/etc目录下。这个文件存放着所有用户帐号的信息,包括用户名和密码,因此,它对系统来说是至关重要的。可以使用如下命令查看该文件:cat /etc/passwd
Passwd文件由许多条记录组成,每条记录占一行,记录了一个用户帐号的所有信息。每条记录由7个字段组成,字段间用冒号“:”隔开,其格式如下:
username:password:User ID:Group ID:comment:home directory:shell
字段含义:
username 用户名
它唯一地标识了一个用户帐号,用户在登录时使用的就是它。
password 该帐号的口令。passwd文件中存放的密码是经过加密处理的。Linux的加密算法很严密,其中的口令几乎是不可能被破解的。盗用帐号的人一般都借助专门的黑客程序,构造出无数个密码,然后使用同样的加密算法将其加密,再和本字段进行比较,如果相同的话,就代表构造出的口令是正确的。因此,建议不要使用生日、常用单词等作为口令,它们在黑客程序面前几乎是不堪一击的。特别是对那些直接连入较大网络的系统来说,系统安全性显得尤为重要。
User ID 用户识别码,简称UID。Linux系统内部使用UID来标识用户,而不是用户名。UID是一个整数,用户的UID互不相同。
Group ID 用户组识别码,简称GID。不同的用户可以属于同一个用户组,享有该用户组共有的权限。与UID类似,GID唯一地标识了一个用户组。
comment 这是给用户帐号做的注解。它一般是用户真实姓名、电话号码、住址等,当然也可以是空的。
home directory 主目录。这个目录属于该帐号,当用户登录后,它就会被置于此目录中,就像回到家一样。一般来说,root帐号的主目录是/root,其他帐号的家目录都在/home目录下,并且和用户名同名。
login command 用户登录后执行的命令。一般来说,这个命令将启动一个shell程序。例如,用bbs帐号登录后,会直接进入bbs系统,这是因为bbs帐号的login command指向的是bbs程序,等系统登录到bbs时就自动运行这些命令。
系统帐号:系统中还有一些默认的帐号,如daemon、bin等。这些帐号有着特殊的用途,一般用于进行系统管理。这些帐号的口令大部分用(x)号表示,代表它们不能在登录时使用。
2,shadow文件
为了增强系统的安全性,Linux系统还可以为用户提供MD5和Shadow安全密码服务。如果在安装 Linux 时在相关配置的选项上选中了MD5和Shadow服务,那么将看到的/etc/passwd文件里的passwd项上无论是什么用户,都是一个“x”,这就表示这些用户都登录不了;系统其实是把真正的密码数据放在了/etc/shadow文件里。
/etc/shadow文件只能以root身份来浏览。为什么要这样做呢,原因其实很简单,在系统设计的时候,/etc/passwd文件是任何人都可以读的,那么那些心有所图的人就可以利用这个文件,使用各种各样的工具按照Linux密码加密的方法把用户甚至root的密码试出来,这样整个系统就会被他所控制,严重危害系统的安全和用户数据的保密性。
3,有关命令
pwconv
根据/etc/passwd文件生成/etc/shadow。它把所有口令从/etc/passwd移到/etc/shadow中。
pwunconv
将/etc/shadow中的信息尽可能地恢复到/etc/passwd。

Ubuntu 8.04 源列表

Posted by 冰河 at 21:48 No Responses » 5,604 Views
十二 182009

Hardy(8.04) 版本
Archive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):

deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
Ubuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):

deb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ hardy main restricted universe multiverse
Mirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):

deb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

Mirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):

deb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse

厦门大学更新服务器(教育网服务器):

deb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse

成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):

deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe

== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==

deb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe

上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):

deb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe

中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):

deb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):

deb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe

沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):

deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe

中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse

Mirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):

deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse

ubuntu.cnsite.org更新服务器(福建省福州市 电信):

deb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse

mirror.rootguide.org更新服务器(上海市 电信):

deb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse

台湾的官方源速度也相当不错,有时甚至快于内地的:

deb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

用之前请ping一下源,测试下网速和可用性。

加源方法:打开终端-sudo gedit /etc/apt/sources.list
输入密码(你安装系统时设置的用户密码),注意密码不会显示,直接回车
把弹出的里面的内容全部清空,然后把提供的源全部粘贴上去(不含中文)
保存,关闭回到终端
输入sudo apt-get update

epoll的实现原理

Posted by 冰河 at 21:47 No Responses » 8,529 Views
十二 182009

1 功能介绍
epoll与select/poll不同的一点是,它是由一组系统调用组成。
int epoll_create(int size);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait(int epfd, struct epoll_event *events,
int maxevents, int timeout);
epoll相关系统调用是在Linux 2.5.44开始引入的。该系统调用针对传统的selec
t/poll系统调用的不足,设计上作了很大的改动。select/poll的缺点在于:
1.每次调用时要重复地从用户态读入参数。
2.每次调用时要重复地扫描文件描述符。
3.每次在调用开始时,要把当前进程放入各个文件描述符的等待队列。在调用结
束后,又把进程从各个等待队列中删除。
在实际应用中,select/poll监视的文件描述符可能会非常多,如果每次只是返回
一小部分,那么,这种情况下select/poll显得不够高效。epoll的设计思路,是把s
elect/poll单个的操作拆分为1个epoll_create+多个epoll_ctrl+一个wait。此外,
内核针对epoll操作添加了一个文件系统”eventpollfs”,每一个或者多个要监视的
文件描述符都有一个对应的eventpollfs文件系统的inode节点,主要信息保存在eve
ntpoll结构体中。而被监视的文件的重要信息则保存在epitem结构体中。所以他们
是一对多的关系。
由于在执行epoll_create和epoll_ctrl时,已经把用户态的信息保存到内核态了
,所以之后即使反复地调用epoll_wait,也不会重复地拷贝参数,扫描文件描述符,
反复地把当前进程放入/放出等待队列。这样就避免了以上的三个缺点。
接下去看看它们的实现:
2 关键结构体:
/* Wrapper struct used by poll queueing */
struct ep_pqueue {
poll_table pt;
struct epitem *epi;
};
这个结构体类似于select/poll中的struct poll_wqueues。由于epoll需要在内核
态保存大量信息,所以光光一个回调函数指针已经不能满足要求,所以在这里引入了
一个新的结构体struct epitem。
/*
* Each file descriptor added to the eventpoll interface will
* have an entry of this type linked to the hash.
*/
struct epitem {
/* RB-Tree node used to link this structure to the eventpoll rb
-tree */
struct rb_node rbn;
红黑树,用来保存eventpoll
/* List header used to link this structure to the eventpoll rea
dy list */
struct list_head rdllink;
双向链表,用来保存已经完成的eventpoll
/* The file descriptor information this item refers to */
struct epoll_filefd ffd;
这个结构体对应的被监听的文件描述符信息
/* Number of active wait queue attached to poll operations */
int nwait;
poll操作中事件的个数
/* List containing poll wait queues */
struct list_head pwqlist;
双向链表,保存着被监视文件的等待队列,功能类似于select/poll中的poll_tab
le
/* The “container” of this item */
struct eventpoll *ep;
指向eventpoll,多个epitem对应一个eventpoll
/* The structure that describe the interested events and the so
urce fd */
struct epoll_event event;
记录发生的事件和对应的fd
/*
* Used to keep track of the usage count of the structure. This
avoids
* that the structure will desappear from underneath our proces
sing.
*/
atomic_t usecnt;
引用计数
/* List header used to link this item to the “struct file” item
s list */
struct list_head fllink;
双向链表,用来链接被监视的文件描述符对应的struct file。因为file里有f_ep
_link,用来保存所有监视这个文件的epoll节点
/* List header used to link the item to the transfer list */
struct list_head txlink;
双向链表,用来保存传输队列
/*
* This is used during the collection/transfer of events to use
rspace
* to pin items empty events set.
*/
unsigned int revents;
文件描述符的状态,在收集和传输时用来锁住空的事件集合
};
该结构体用来保存与epoll节点关联的多个文件描述符,保存的方式是使用红黑树
实现的hash表。至于为什么要保存,下文有详细解释。它与被监听的文件描述符一一
对应。
struct eventpoll {
/* Protect the this structure access */
rwlock_t lock;
读写锁
/*
* This semaphore is used to ensure that files are not removed
* while epoll is using them. This is read-held during the even
t
* collection loop and it is write-held during the file cleanup
* path, the epoll file exit code and the ctl operations.
*/
struct rw_semaphore sem;
读写信号量
/* Wait queue used by sys_epoll_wait() */
wait_queue_head_t wq;
/* Wait queue used by file->poll() */
wait_queue_head_t poll_wait;
/* List of ready file descriptors */
struct list_head rdllist;
已经完成的操作事件的队列。
/* RB-Tree root used to store monitored fd structs */
struct rb_root rbr;
保存epoll监视的文件描述符
};
这个结构体保存了epoll文件描述符的扩展信息,它被保存在file结构体的priva
te_data中。它与epoll文件节点一一对应。通常一个epoll文件节点对应多个被监视
的文件描述符。所以一个eventpoll结构体会对应多个epitem结构体。
那么,epoll中的等待事件放在哪里呢?见下面
/* Wait structure used by the poll hooks */
struct eppoll_entry {
/* List header used to link this structure to the “struct epite
m” */
struct list_head llink;
/* The “base” pointer is set to the container “struct epitem” *
/
void *base;
/*
* Wait queue item that will be linked to the target file wait
* queue head.
*/
wait_queue_t wait;
/* The wait queue head that linked the “wait” wait queue item *
/
wait_queue_head_t *whead;
};
与select/poll的struct poll_table_entry相比,epoll的表示等待队列节点的结
构体只是稍有不同,与struct poll_table_entry比较一下。
struct poll_table_entry {
struct file * filp;
wait_queue_t wait;
wait_queue_head_t * wait_address;
};
由于epitem对应一个被监视的文件,所以通过base可以方便地得到被监视的文件
信息。又因为一个文件可能有多个事件发生,所以用llink链接这些事件。
3 epoll_create的实现
epoll_create()的功能是创建一个eventpollfs文件系统的inode节点。具体由ep
_getfd()完成。ep_getfd()先调用ep_eventpoll_inode()创建一个inode节点,然后
调用d_alloc()为inode分配一个dentry。最后把file,dentry,inode三者关联起来。
在执行了ep_getfd()之后,它又调用了ep_file_init(),分配了eventpoll结构体
,并把eventpoll的指针赋给file结构体,这样eventpoll就与file结构体关联起来了

需要注意的是epoll_create()的参数size实际上只是起参考作用,只要它不小于
等于0,就并不限制这个epoll inode关联的文件描述符数量。
4 epoll_ctl的实现
epoll_ctl的功能是实现一系列操作,如把文件与eventpollfs文件系统的inode节
点关联起来。这里要介绍一下eventpoll结构体,它保存在file->f_private中,记录
了eventpollfs文件系统的inode节点的重要信息,其中成员rbr保存了该epoll文件节
点监视的所有文件描述符。组织的方式是一棵红黑树,这种结构体在查找节点时非常
高效。
首先它调用ep_find()从eventpoll中的红黑树获得epitem结构体。然后根据op参
数的不同而选择不同的操作。如果op为EPOLL_CTL_ADD,那么正常情况下epitem是不
可能在eventpoll的红黑树中找到的,所以调用ep_insert创建一个epitem结构体并插
入到对应的红黑树中。
ep_insert()首先分配一个epitem对象,对它初始化后,把它放入对应的红黑树。
此外,这个函数还要作一个操作,就是把当前进程放入对应文件操作的等待队列。这
一步是由下面的代码完成的。
init_poll_funcptr(&epq.pt, ep_ptable_queue_proc);
。。。
revents = tfile->f_op->poll(tfile, &epq.pt);
函数先调用init_poll_funcptr注册了一个回调函数 ep_ptable_queue_proc,这
个函数会在调用f_op->poll时被执行。该函数分配一个epoll等待队列结点eppoll_e
ntry:一方面把它挂到文件操作的等待队列中,另一方面把它挂到epitem的队列中
。此外,它还注册了一个等待队列的回调函数ep_poll_callback。当文件操作完成,
唤醒当前进程之前,会调用ep_poll_callback(),把eventpoll放到epitem的完成队
列中,并唤醒等待进程。
如果在执行f_op->poll以后,发现被监视的文件操作已经完成了,那么把它放在
完成队列中了,并立即把等待操作的那些进程唤醒。
5 epoll_wait的实现
epoll_wait的工作是等待文件操作完成并返回。
它的主体是ep_poll(),该函数在for循环中检查epitem中有没有已经完成的事件
,有的话就把结果返回。没有的话调用schedule_timeout()进入休眠,直到进程被再
度唤醒或者超时。
6 性能分析
epoll机制是针对select/poll的缺陷设计的。通过新引入的eventpollfs文件系统
,epoll把参数拷贝到内核态,在每次轮询时不会重复拷贝。通过把操作拆分为epol
l_create,epoll_ctl,epoll_wait,避免了重复地遍历要监视的文件描述符。此外,
由于调用epoll的进程被唤醒后,只要直接从epitem的完成队列中找出完成的事件,
找出完成事件的复杂度由O(N)降到了O(1)。
但是epoll的性能提高是有前提的,那就是监视的文件描述符非常多,而且每次完
成操作的文件非常少。所以,epoll能否显著提高效率,取决于实际的应用场景。这
方面需要进一步测试。

Nginx PHP No input file specified

Posted by 冰河 at 21:45 No Responses » 24,538 Views
十二 182009

刚装好Nginx,马上加了个 PHPINFO

  1. <?php
  2. phpinfo();
  3. ?>

然后在游览器下运行 结果是

No input file specified.

以下内容为网络收集

FastCGI模式下访问php文件时,出现No input file specified.错误
查看access.log 发现是 404

原因分析:
任何对.php文件的请求,都简单地交给php-cgi去处理,但没有验证该php文件是否存在。PHP文件不存在,没办法返回普通的404错误,它返回一个404,并带上一句”No input file specified”

另外,还可能跟 路径或者 权限有关系,或者SCRIPT_FILENAME 变量没有被正确的设置(这在nginx是最常见的原因)

1)如果html也出现404错误,那么就是document root 设置的有问题
2)检查脚本文件的权限, 可能PHP或者web server不能读取它
3)SCRIPT_FILENAME设置错误

可以使用
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
必须保证 $document_root 在配置文件中,在astcgi_param SCRIPT_FILENAME前面被用到过一次, 后面有解释为什么。

或者
修改/etc/php5/cgi/php.ini中cgi.fix_pathinfo=1
这样也可让php-cgi正常使用SCRIPT_FILENAME这个变量

有人说,这样改也行
fastcgi_param SCRIPT_NAME /home/gavin/nginx/$fastcgi_script_name;

让我们看看PHP对这两个变量是怎么解释的吧
SCRIPT_NAME
SCRIPT_FILENAME
据说,必须指定正确的SCRIPT_FILENAME, PHP-CGI会忽略SCRIPT_NAME(即使它的值设置的是正确的)
或者指定特殊的php.ini, 设置doc_root, discard path, fix pathinfo等等

script_filename 只是被用做一种快捷方式。 如果fix_pathinfo设置打开,init函数将它用来决定真实的路径

因为配置文件会改变 nginx的变量$fastcgi_script_name

fastcgi_param SCRIPT_NAME /home/gavin/nginx/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME /home/gavin/nginx/$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

这两种配置都是可以的


fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
也是可以的,但必须保证 $document_root 被正确设置过

‘SCRIPT_FILENAME’
当前执行脚本的绝对路径名(pathname)
‘SCRIPT_NAME’
含有当前脚本的路径。当页面需要指向他们自己时,有用. __FILE__ 常量包含路径和文件名

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP’s
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix it’s paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; cgi.fix_pathinfo=0

主要跟CGI标准的
PATH_INFO
PATH_TRANSLATED
SCRIPT_NAME
有关系
修修改了好多
最终主要修改的

把 NGINX DEFAULT 那个文件中的

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

改成实际的路径

今天我是这种情况

我的是fastcgi_param SCRIPT_NAME /var/www/nginx-default/$fastcgi_script_name;

然后就好了
上面的文章供参考
如果试了还不行 多看看内容再试试

十二 182009

一、sysv-rc-conf简介
sysv-rc-conf是一个强大的服务管理程序,群众的意见是sysv-rc-conf比chkconfig、rcconf好用。
二、背景知识
1、Ubuntu运行级别
Linux 系统任何时候都运行在一个指定的运行级上,并且不同的运行级的程序和服务都不同,所要完成的工作和要达到的目的都不同,系统可以在这些运行
级之间进行切换,以完成不同的工作。
Ubuntu 的系统运行级别:
0 系统停机状态
1 单用户或系统维护状态
2~5 多用户状态
6 重新启动
查看当前运行级别,执行命令:
runlevel
( runlevel 显示上次的运行级别和当前的运行级别,“N”表示没有上次的运行级别。)
切换运行级别,执行命令:
int [0123456Ss]
( 即在 init 命令后跟一个参数,此参数是要切换到的运行级的运行级代号,如:用 init 0 命令关机;用 init 6 命令重新启动。)
Linux 系统主要启动步骤:
1. 读取 MBR 的信息,启动 Boot Manager
Windows 使用 NTLDR 作为 Boot Manager,如果您的系统中安装多个
版本的 Windows,您就需要在 NTLDR 中选择您要进入的系统。
Linux 通常使用功能强大,配置灵活的 GRUB 作为 Boot Manager。
2. 加载系统内核,启动 init 进程
init 进程是 Linux 的根进程,所有的系统进程都是它的子进程。
3. init 进程读取 /etc/inittab 文件中的信息,并进入预设的运行级别,
按顺序运行该运行级别对应文件夹下的脚本。脚本通常以 start 参数启
动,并指向一个系统中的程序。
通常情况下, /etc/rcS.d/ 目录下的启动脚本首先被执行,然后是
/etc/rcN.d/ 目录。例如您设定的运行级别为 3,那么它对应的启动
目录为 /etc/rc3.d/ 。
4. 根据 /etc/rcS.d/ 文件夹中对应的脚本启动 Xwindow 服务器 xorg
Xwindow 为 Linux 下的图形用户界面系统。
5. 启动登录管理器,等待用户登录
Ubuntu 系统默认使用 GDM 作为登录管理器,您在登录管理器界面中
输入用户名和密码后,便可以登录系统。(您可以在 /etc/rc3.d/
文件夹中找到一个名为 S13gdm 的链接)
三、安装sysv-rc-conf
sudo apt-get install sysv-rc-conf
四、使用sysv-rc-conf
sudo sysv-rc-conf
操作界面十分简洁,你可以用鼠标点击,也可以用键盘方向键定位,用空格键选择,用Ctrl+N翻下一页,用Ctrl+P翻上一页,用Q退出。
常见的系统服务有:
acpi-support 高级电源管理支持
acpid acpi 守护程序.这两个用于电源管理,非常重要
alsa 声音子系统
alsa-utils
anacron cron 的子系统,将系统关闭期间的计划任务,在下一次系统运行时执行。
apmd acpi 的扩展
atd 类似于 cron 的任务调度系统。建议关闭
binfmt-support 核心支持其他二进制的文件格式。建议开启
bluez-utiles 蓝牙设备支持
bootlogd 启动日志。开启它
cron 任务调度系统,建议开启
cupsys 打印机子系统。
dbus 消息总线系统(message bus system)。非常重要
dns-clean 使用拨号连接时,清除 dns 信息。
evms 企业卷管理系统(Enterprise Volumn Management system)
fetchmail 邮件用户代理守护进程,用于收取邮件
gdm gnome 登录和桌面管理器。
gdomap
gpm 终端中的鼠标支持。
halt 别动它。
hdparm 调整硬盘的脚本,配置文件为 /etc/hdparm.conf。
hibernate 系统休眠
hotkey-setup 笔记本功能键支持。支持类型包括: HP, Acer, ASUS, Sony,Dell, 和 IBM。
hotplug and hotplug-net 即插即用支持,比较复杂,建议不要动它。
hplip HP 打印机和图形子系统
ifrename 网络接口重命名脚本。如果您有十块网卡,您应该开启它
inetd 在文件 /etc/inetd.conf 中,注释掉所有你不需要的服务。如果该文件不包含任何服务,那关闭它是很安全的。
klogd 重要。
linux-restricted-modules-common 受限模块支持。
/lib/linux-restricted-modules/ 文件夹中的模块为受限模块。例如某些驱动程序,如果您没有使用受限模块,就不需要开启它。
lvm 逻辑卷管理系统支持。
makedev 创建设备文件,非常重要。
mdamd 磁盘阵列
module-init-tools 从/etc/modules 加载扩展模块,建议开启。
networking 网络支持。按 /etc/network/interfaces 文件预设激活网络,非常重要。
ntpdate 时间同步服务,建议关闭。
pcmcia pcmcia 设备支持。
powernowd 移动 CPU 节能支持
ppp and ppp-dns 拨号连接
readahead 预加载库文件。
reboot 别动它。
resolvconf 自动配置 DNS
rmnologin 清除 nologin
rsync rsync 守护程序
sendsigs 在重启和关机期间发送信号
single 激活单用户模式
ssh ssh 守护程序。建议开启
stop-bootlogd 在 2,3,4,5 运行级别中停止 bootlogd 服务
sudo 检查 sudo 状态。重要
sysklogd 系统日志
udev & udev-mab 用户空间 dev 文件系统(userspace dev filesystem)。重要
umountfs 卸载文件系统
urandom 随机数生成器
usplash 开机画面支持
vbesave 显卡 BIOS 配置工具。保存显卡的状态
xorg-common 设置 X 服务 ICE socket。
adjtimex 调整核心时钟的工具
dirmngr 证书列表管理工具,和 gnupg 一起工作。
hwtools irqs 优化工具
libpam-devperm 系统崩溃之后,用于修理设备文件许可的守护程序。
lm-sensors 板载传感器支持
mdadm-raid 磁盘陈列管理器
screen-cleanup 清除开机屏幕的脚本
xinetd 管理其他守护进程的一个 inetd 超级守护程序

十二 182009

  从传统意义上讲,Proxy Server即代理服务器是指位于用户计算机网络与互联网之间的服务器,其功能就是代理网络用户去取得网络信息,可以把它理解为网络信息的中转站。如果 WEB浏览器配置为使用代理服务器的话,所有的请求都只会通过代理转发,代理服务器会按照用户的要求向站点发出访问请求,并针对各种应用依次采用不同的过 滤规则。

  “透明代理服务器”指的是在客户端完全不知晓的情况下,对代理服务器进行配置,使其可以处理用户请求。其缺点是代理服务器不支持SSL,但是用 户浏览器不需要对普通HTTP通信(即明文HTTP通信)配置,很多情况下,它与高速缓存代理服务器一起使用,代理服务器从其高速缓存中访问图片和其它文 件,而无需每次都占用互联网带宽从web服务器上获取。

  反向代理服务器(Reverse Proxy Server),通过在繁忙的WEB服务器和Internet之间增加一个高速的WEB缓冲服务器来降低实际的WEB服务器的负载,提高对WEB页面的访 问速度。反向代理服务器位于用户WEB服务器和互联网之间。当一个HTTP连接进入时,反向代理服务器会决定所执行的操作,然后向后端的WEB服务器发出 请求。反向代理服务器相当重要,它们常常肩负多种任务。

  反向代理服务器可以是一个SSL终结器。这意味着SSL授权证书及其密钥都被装在代理服务器上,连同这些站点的对应IP地址。SSL因此被终止 在代理服务器,而且对后端服务器的请求将会以纯文本的形式传送。这在通常情况下确实不错,但如果你的终端网络是不安全的,网络骗术可通过安全通道获取所需 要的服务请求。

  在这儿我们要探讨一下虚拟主机和SSL。虚拟主机的概念是基于站点名称的,在连接HTTP报头数据方面起作用。当发出了HTTP请求后,支持虚 拟主机的WEB服务器会为不同的内容服务,这些内容是基于被请求站点的。本质上讲,这意味着你可以将多个域名指向一个相同的IP地址。如果启用了SSL, 必须与特定的IP地址相结合,而且SSL授权证书必须与站点的名称相匹配,此站点正是用户试图访问的站点。SSL对话在HTTP数据发送之前进行,因而服 务器只有一个选择,即一个授权证书呈现一个IP地址。如果在一个SSL连接建立之后,却发现请求的URL属于另一个站点,WEB浏览器会通知用户。如果它 不如此工作,SSL就毫无意义了。

  一个代理服务器也可以是一个负载平衡器。负载平衡从其基本意义上讲,其工作方式不外乎两种,实际工作时可以某一种方式运行。第一种工作方式即智 能地在IP层循环访问一组服务器,第二种方式通过使用代理服务器来做一些更加智能的工作。一组服务器可以使用DNS轮询为站点服务。多个DNS记录可以配 送给一个主机名,因此连接就会从这一组服务器中选择一个。当然,这对于使用SSL站点进行管理真是一种痛苦。路由器也可以以相似的方式实现负载平衡,这就 要求保存现有的状态从而使后续的请求可以被传送到适当的服务器。不过,如此运作的大多数设备都只是充当一个代理服务器。使用代理服务器实现负载平衡很有意 义,特别是在考虑了它所提供的其它特性以后。

  反向代理服务器可以充当一种WEB服务器的应用层防火墙。实际上,它包含两个方面:进入的请求受到代理服务器中所配置的规则和策略的制约,而WEB服务器被封闭起来,与外部世界隔离,从而有效地抵消了跨站点的脚本攻击。

  反向代理服务器还经常担当内容过滤器的职责,虽然过滤与防火墙息息相关,但反向代理却拥有更佳的性能。大多数代理服务器厂商实施一种阻止某些关键字或内容类型的机制。这可以是防止恶意代码攻击真实服务器的另一个层次。

  前端代理服务器可以执行的大量任务也可以被反向代理服务器完成。一台高速缓存服务器,如squid,可以在多种配置中与反向代理服务器协同工 作。如果反向代理服务器不支持高速缓存,很多站点会选择通过一个高速缓存代理来配置对后端服务器的访问,这样图像和其它静态内容就不必从真实服务器中检 索。许多反向代理服务器也可以将一些特定的任务,如图片出租给一个完全独立的服务器。这些代理服务器通常被称为“WEB加速器”。

  有许多代理服务器产品能够以反向代理服务器模式运行,在此我们只关注几个免费的开源产品。Apache2.2现在伴随着模块代理服务平衡器一起使用。Apache依靠 模块代理支持反向代理服务器已有很长时间了,但是通过使用平衡器模块,Apache可以实现更加复杂和更有弹性的配置。当然,配置并非十分简单,Apache本身资源密集而且对内存要求很高。

  Pound是一个反向代理服务器及负载平衡器,可以终止SSL连接。配置相当简易,它与Apache相比的极大优势在于它经过精心编制、小巧灵活。许多Pound用户给出了其相当惊人的吞吐量统计,当然它也一直是可靠有效的。

© 2009 - 2024 冰河的博客