<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>互联网开发记事本</title>
	<atom:link href="http://www.jgcao.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jgcao.com</link>
	<description>记录学习、工作中的经验和教训</description>
	<lastBuildDate>Mon, 17 May 2010 04:28:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>PHPDocument 代码注释规范</title>
		<link>http://www.jgcao.com/index.php/2010/05/phpdocument-%e4%bb%a3%e7%a0%81%e6%b3%a8%e9%87%8a%e8%a7%84%e8%8c%83/</link>
		<comments>http://www.jgcao.com/index.php/2010/05/phpdocument-%e4%bb%a3%e7%a0%81%e6%b3%a8%e9%87%8a%e8%a7%84%e8%8c%83/#comments</comments>
		<pubDate>Mon, 17 May 2010 04:26:58 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=853</guid>
		<description><![CDATA[一、如何写PHP规范注释 所有的文档标记都是在每一行的 * 后面以@开头。 如果在一段话的中间出来@的标记，这个标记将会被当做普通内容而被忽略掉。 @access //该标记用于指明关键字的存取权限：private、public或proteced 使用范围：class,function,var,define,module @author //指明作者 @copyright //指明版权信息 @const //使用范围：define 用来指明php中define的常量 @final //使用范围：class,function,var 指明关键字是一个最终的类、方法、属性，禁止派生、修改。 @global //指明在此函数中引用的全局变量 @name //为关键字指定一个别名。 @package //用于逻辑上将一个或几个关键字分到一组。 @abstrcut //说明当前类是一个抽象类 @param //指明一个函数的参数 @return //指明一个方法或函数的返回值 @static //指明关建字是静态的。 @var //指明变量类型 @version //指明版本信息 @todo //指明应该改进或没有实现的地方 @link //可以通过link指到文档中的任何一个关键字 @ingore //用于在文档中忽略指定的关键字 二、一些注释规范 1、注释必须是下面形式 /** * XXXXXXX */ 2、对于引用了全局变量的函数，必须使用glboal标记。 3、对于变量，必须用var标记其类型（int,string,bool&#8230;） 4、函数必须通过param和return标记指明其参数和返回值 5、对于出现两次或两次以上的关键字，要通过ingore忽略掉多余的，只保留一个即可 6、调用了其他函数或类的地方，要使用link或其他标记链接到相应的部分，便于文档的阅读。 7、必要的地方使用非文档性注释（PHPDOC无法识别的关键字前的注释），提高代码易读性。 8、描述性内容尽量简明扼要，尽可能使用短语而非句子。 [...]]]></description>
			<content:encoded><![CDATA[<p>一、如何写PHP规范注释</p>
<p>所有的文档标记都是在每一行的 * 后面以@开头。<br />
如果在一段话的中间出来@的标记，这个标记将会被当做普通内容而被忽略掉。</p>
<pre class="php" name="code">
@access
//该标记用于指明关键字的存取权限：private、public或proteced 使用范围：class,function,var,define,module

@author
//指明作者

@copyright
//指明版权信息

@const
//使用范围：define 用来指明php中define的常量

@final
//使用范围：class,function,var 指明关键字是一个最终的类、方法、属性，禁止派生、修改。

@global
//指明在此函数中引用的全局变量

@name
//为关键字指定一个别名。

@package
//用于逻辑上将一个或几个关键字分到一组。

@abstrcut
//说明当前类是一个抽象类

@param
//指明一个函数的参数

@return
//指明一个方法或函数的返回值

@static
//指明关建字是静态的。

@var
//指明变量类型

@version
//指明版本信息

@todo
//指明应该改进或没有实现的地方

@link
//可以通过link指到文档中的任何一个关键字

@ingore
//用于在文档中忽略指定的关键字
</pre>
<p>二、一些注释规范<br />
1、注释必须是下面形式</p>
<pre class="php" name="code">
/**
* XXXXXXX
*/
</pre>
<p>2、对于引用了全局变量的函数，必须使用glboal标记。<br />
3、对于变量，必须用var标记其类型（int,string,bool&#8230;）<br />
4、函数必须通过param和return标记指明其参数和返回值<br />
5、对于出现两次或两次以上的关键字，要通过ingore忽略掉多余的，只保留一个即可<br />
6、调用了其他函数或类的地方，要使用link或其他标记链接到相应的部分，便于文档的阅读。<br />
7、必要的地方使用非文档性注释（PHPDOC无法识别的关键字前的注释），提高代码易读性。<br />
8、描述性内容尽量简明扼要，尽可能使用短语而非句子。<br />
9、全局变量，静态变量和常量必须用相应标记说明</p>
<p>三、能够被phpdoc识别的关键字：</p>
<pre class="php" name="code">
include
require
include_once
require_once
define
function
global
class
</pre>
<p>四、 规范注释的php代码实例 :</p>
<pre class="php" name="code">
/**
* 文件名(sample.php)
*
* 功能描述（略）
*
* @author jgcao <jgcao#live.cn>
* @version 1.0
* @package sample
*/

/**
* 包含文件
*/
include_once 'common.php';

/**
* 声明全局变量
* @global integer $GLOBALS['myvar']
* @name $myvar
*/
$GLOBALS['myvar'] = 6;

/**
* 声明全局常量
*/
define('NUM', 6);

/**
* 类名
*
* 类功能描述
*
* @package sample
* @subpackage classes(如果是父类 就添加)
*/
class myclass {

	/**
	* 声明普通变量
	*
	* @accessprivate
	* @var integer|string
	*/
	var $firstvar = 6;

	/**
	* 创建构造函数 {@link $firstvar}
	*/
	function myclass() {
		$this->firstvar = 7;
	}

	/**
	* 定义函数
	*
	* 函数功能描述
	*
	* @global string $_myvar
	* @staticvar integer $staticvar
	* @param string $param1
	* @param string $param2
	* @return integer|string
	*/
	function firstFunc($param1, $param2 = 'optional') {
		static $staticvar = 7;
		global $_myvar;
		return $staticvar;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/05/phpdocument-%e4%bb%a3%e7%a0%81%e6%b3%a8%e9%87%8a%e8%a7%84%e8%8c%83/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>理解JavaScript中apply与call的用法区别</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3javascript%e4%b8%adapply%e4%b8%8ecall%e7%9a%84%e7%94%a8%e6%b3%95%e5%8c%ba%e5%88%ab/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3javascript%e4%b8%adapply%e4%b8%8ecall%e7%9a%84%e7%94%a8%e6%b3%95%e5%8c%ba%e5%88%ab/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 08:02:58 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=851</guid>
		<description><![CDATA[//apply 用法 funObj.apply([thisObj[,argArray]]); //call 用法 funObj.call([thisObj[,arg1[, arg2[, [,.argN]]]]]) //thisObj 可选项。将被用作当前对象的对象。 var newFun = new function() { this.a = 10; this.b = 20; } function runFun(a,b) { alert(a+b); alert(this.a + this.b); } runFun.call(newFun,3,5); runFun.apply(newFun,new Array(3,5)); //对于apply和call两者在作用上是相同的，但两者在参数上有区别的。 //对于第一个参数意义都一样，但对第二个参数： //apply传入的是一个参数数组，也就是将多个参数组合成为一个数组传入，而call则作为call的参数传入（从第二个参数开始）。]]></description>
			<content:encoded><![CDATA[<pre class="javascript" name="code">
//apply 用法
funObj.apply([thisObj[,argArray]]);

//call 用法
funObj.call([thisObj[,arg1[, arg2[,   [,.argN]]]]])

//thisObj 可选项。将被用作当前对象的对象。

var newFun = new function()
{
	this.a = 10;
	this.b = 20;
}

function runFun(a,b)
{
	alert(a+b);
	alert(this.a + this.b);
}

runFun.call(newFun,3,5);

runFun.apply(newFun,new Array(3,5));

//对于apply和call两者在作用上是相同的，但两者在参数上有区别的。
//对于第一个参数意义都一样，但对第二个参数：
//apply传入的是一个参数数组，也就是将多个参数组合成为一个数组传入，而call则作为call的参数传入（从第二个参数开始）。
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3javascript%e4%b8%adapply%e4%b8%8ecall%e7%9a%84%e7%94%a8%e6%b3%95%e5%8c%ba%e5%88%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>理解apache配置</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3apache%e9%85%8d%e7%bd%ae/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3apache%e9%85%8d%e7%bd%ae/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 03:02:51 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=848</guid>
		<description><![CDATA[# # Apache服务器主配置文件. 包括服务器指令的目录设置. # 详见 # # 请在理解用途的基础上阅读各指令。 # # 再读取此文档后，服务器将继续搜索运行 # E:/Program Files/Apache Group/Apache/conf/srm.conf # E:/Program Files/Apache Group/Apache/conf/access.conf # 除非用ResourceConfig或AccessConfig覆盖这儿的标识 # # 配置标识由三个基本部分组成: # 1. 作为一个整体来控制Apache服务器进程的标识 (the &#8216;global environment&#8217;). # 2. 用于定义主（默认）服务器参数的标识。 # 响应虚拟主机不能处理的请求。 # 同时也提供所有虚拟主机的设置值。 # 3. 虚拟主机的设置。在一个Apache服务器进程中配置不同的IP地址和主机名。 # # 配置和日志文件名：指定服务器控制文件命名时， # 以 &#8220;/&#8221; (或 &#8220;drive:/&#8221; for Win32)开始，服务器将使用这些绝对路径。 # 如果文件名不是以&#8221;/&#8221;开始的，预先考虑服务器根目录&#8211; # 因此 [...]]]></description>
			<content:encoded><![CDATA[<p>#<br />
# Apache服务器主配置文件.  包括服务器指令的目录设置.<br />
# 详见 <URL:http://www.apache.org/docs/><br />
#<br />
# 请在理解用途的基础上阅读各指令。<br />
#<br />
# 再读取此文档后，服务器将继续搜索运行<br />
# E:/Program Files/Apache Group/Apache/conf/srm.conf<br />
# E:/Program Files/Apache Group/Apache/conf/access.conf<br />
# 除非用ResourceConfig或AccessConfig覆盖这儿的标识<br />
#<br />
# 配置标识由三个基本部分组成:<br />
#  1. 作为一个整体来控制Apache服务器进程的标识 (the &#8216;global environment&#8217;).<br />
#  2. 用于定义主（默认）服务器参数的标识。<br />
#     响应虚拟主机不能处理的请求。<br />
#     同时也提供所有虚拟主机的设置值。<br />
#  3. 虚拟主机的设置。在一个Apache服务器进程中配置不同的IP地址和主机名。<br />
#<br />
# 配置和日志文件名：指定服务器控制文件命名时，<br />
# 以 &#8220;/&#8221; (或 &#8220;drive:/&#8221; for Win32)开始，服务器将使用这些绝对路径。<br />
# 如果文件名不是以&#8221;/&#8221;开始的，预先考虑服务器根目录&#8211;<br />
#  因此 &#8220;logs/foo.log&#8221;，如果服务器根目录是&#8221;/usr/local/apache&#8221;，<br />
#  服务器将解释为 &#8220;/usr/local/apache/logs/foo.log&#8221;.<br />
#<br />
# 注: 指定的文件名需要用&#8221;/&#8221;代替&#8221;\&#8221;。<br />
# (例, &#8220;c:/apache&#8221; 代替 &#8220;c:\apache&#8221;).<br />
# 如果省略了驱动器名，默认使用Apache.exe所在的驱动器盘符<br />
# 建议指定盘符，以免混乱。<br />
#</p>
<p>### 部分 1: 全局环境<br />
#<br />
# 本部分的表示将影响所有Apache的操作<br />
# 例如，所能处理的并发请求数或配置文件地址<br />
#</p>
<p>#<br />
# ServerType 可取值 inetd 或 standalone.  Inetd 只适用于Unix平台<br />
#<br />
ServerType standalone</p>
<p>#<br />
# ServerRoot: 目录树的根结点。服务器配置、出错信息、日志文件都保存在根目录下。<br />
#<br />
# 不要再目录末尾加&#8221;/&#8221;<br />
#<br />
ServerRoot &#8220;C:/Program Files/Apache Group/Apache&#8221;</p>
<p>#<br />
# PidFile: 服务器用于记录启动时进程ID的文件。<br />
#<br />
PidFile logs/httpd.pid</p>
<p>#<br />
# ScoreBoardFile: 用于保存内部服务器进程信息的文件。<br />
# 并非必须。 但是如果指定了（此文件当运行Apache时生成）<br />
# 那么必须确保没有两个Apache进程共享同一个scoreboard文件。<br />
#<br />
ScoreBoardFile logs/apache_runtime_status</p>
<p>#<br />
# 在标准配置下，服务器将顺序读取 httpd.conf(此文件可通过命令行中-f参数指定），<br />
# srm.conf 和 access.conf。<br />
# 目前后两个文件是空的。为了简单起见，建议将所有的标识放在一个文件中。<br />
# 以下两条注释的标识，是默认设置。<br />
# 要让服务器忽略这些文件可以用 &#8220;/dev/null&#8221; (for Unix)<br />
# 或&#8221;nul&#8221; (for Win32) 作为参数。<br />
#<br />
#ResourceConfig conf/srm.conf<br />
#AccessConfig conf/access.conf</p>
<p>#<br />
# Timeout: 接受和发送timeout的时间<br />
#<br />
Timeout 300</p>
<p>#<br />
# KeepAlive: 是否允许保持连接（每个连接有多个请求）<br />
# &#8220;Off&#8221; -无效<br />
#<br />
KeepAlive On</p>
<p>#<br />
# MaxKeepAliveRequests: 每个连接的最大请求数。<br />
# 设置为0表示无限制<br />
# 建议设置较高的值，以获得最好的性能。<br />
#<br />
MaxKeepAliveRequests 100</p>
<p>#<br />
# KeepAliveTimeout: 同一连接同一客户端两个请求之间的等待时间。<br />
#<br />
KeepAliveTimeout 15</p>
<p>#<br />
# 在Win32下,Apache每次产生一个子进程来处理请求。<br />
# 如果这个进程死了，会自动产生另一个子进程。<br />
# 所有的进入请求在子进程中多线程处理。<br />
# 以下两个标识控制进程的运行<br />
#</p>
<p>#<br />
# MaxRequestsPerChild: 每个子进程死亡之前最大请求数<br />
# 如果超过这个请求数，子程序会自动退出，避免延期使用导致内存溢出或其他问题。<br />
# 大部分系统，并不需要此设置，<br />
# 但是部分，象Solaris，确实值得注意。<br />
# 对Win32, 可设置为0 (无限制)<br />
# 除非有另外的考虑。<br />
#<br />
# 注: 此值不包括在每个连接初始化请求后，&#8221;keptalive&#8221;请求<br />
#       例如, 如果一个子进程处理一个初始化请求和10个后续&#8221;keptalive&#8221;请求，<br />
#       在这个限制下，只会记为一个请求。<br />
#<br />
MaxRequestsPerChild 0</p>
<p>#<br />
# ThreadsPerChild: 服务器所允许的并发线程数。<br />
# 此值的设置取决于服务器的响应能力（约多的请求在同一时间激活，则每个请求的处理时间越慢）<br />
# 和服务器所允许消耗的系统资源。<br />
#<br />
ThreadsPerChild 50</p>
<p>#<br />
# Listen: 允许将Apache绑顶到指定的IP地址和端口，作为默认值的辅助选项。<br />
# 参见 <VirtualHost><br />
#<br />
#Listen 3000<br />
#Listen 12.34.56.78:80</p>
<p>#<br />
# BindAddress: 通过此选项可支持虚拟主机。<br />
# 此标识用于告诉服务器监听哪个IP地址。<br />
# 包括：&#8221;*&#8221;, IP地址, 或域名.<br />
# 参见 <VirtualHost> 和 Listen directives.<br />
#<br />
BindAddress 166.111.178.144</p>
<p>#<br />
# Apache模块编译成标准的Windows结构。<br />
#<br />
# 以下模块绑定到标准的Apache二进制windows分布。<br />
# 要修改标准操作，取消以下行的注释并且修改指定模块列表。<br />
#<br />
# 警告：这是高级选项。可能导致服务器崩溃。<br />
# 没有专家的指导，不要轻易修改。<br />
#<br />
#ClearModuleList<br />
#AddModule mod_so.c mod_mime.c mod_access.c mod_auth.c mod_negotiation.c<br />
#AddModule mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_userdir.c<br />
#AddModule mod_alias.c mod_env.c mod_log_config.c mod_asis.c mod_imap.c<br />
#AddModule mod_actions.c mod_setenvif.c mod_isapi.c</p>
<p>#<br />
# 动态共享对象（Dynamic Shared Object，DSO）<br />
#<br />
# 要使用基于DSO的功能模块，需要替换此处相应的<br />
#  `LoadModule&#8217; 行。这样在使用之前这些包含的标识都将生效。<br />
# 有关DSO及至的详细资料请看Apache1.3版中的README.DSOSO。<br />
# 运行&#8221;apche -l&#8221;将列表显示Apache内奸的模块（类似标准的连接已经生效）<br />
#<br />
# 注：模块载入的顺序很重要。没有专家的建议，不要修改以下的顺序。<br />
#<br />
#LoadModule anon_auth_module modules/ApacheModuleAuthAnon.dll<br />
#LoadModule dbm_auth_module modules/ApacheModuleAuthDBM.dll<br />
#LoadModule digest_auth_module modules/ApacheModuleAuthDigest.dll<br />
#LoadModule cern_meta_module modules/ApacheModuleCERNMeta.dll<br />
#LoadModule digest_module modules/ApacheModuleDigest.dll<br />
#LoadModule expires_module modules/ApacheModuleExpires.dll<br />
#LoadModule headers_module modules/ApacheModuleHeaders.dll<br />
#LoadModule proxy_module modules/ApacheModuleProxy.dll<br />
#LoadModule rewrite_module modules/ApacheModuleRewrite.dll<br />
#LoadModule speling_module modules/ApacheModuleSpeling.dll<br />
#LoadModule info_module modules/ApacheModuleInfo.dll<br />
#LoadModule status_module modules/ApacheModuleStatus.dll<br />
#LoadModule usertrack_module modules/ApacheModuleUserTrack.dll</p>
<p>#<br />
# ExtendedStatus 在服务器状态句柄被呼叫时控制是产生“完整”的状态信息(ExtendedStatus On)<br />
# 还是仅返回基本信息(ExtendedStatus Off)<br />
# 默认是：Off<br />
#<br />
#ExtendedStatus On</p>
<p>### 部分 2: 主服务器配置<br />
#<br />
# 此部分的标识用于主服务器所有的设置值，<br />
# 响应任何<VirtualHost>定义不处理的请求<br />
# 这些值同时给你稍后在此文件中定义的<VirtualHost>提供默认值。<br />
#<br />
# 所有的标识可能会在<VirtualHost>中出现。<br />
# 对应的默认值会被虚拟主机重新定义覆盖。<br />
#</p>
<p>#<br />
# Port: Standalone服务器监听的端口。<br />
# 在Apache能够监听指定端口前，需要在防火墙中进行设置。<br />
# 其它运行httpd的服务器也可能影响此端口。  Disable<br />
# 如果遇到问题，请关闭所有的防火墙、安全保护和其他的服务。<br />
# Windos NT的&#8221;NETSTAT -a&#8221;指令会有助于问题的分析。<br />
#<br />
Port 80</p>
<p>#<br />
# ServerAdmin: 你的地址。如果服务器有任何问题将发信到这个地址。<br />
# 这个地址会在服务器产生的某些页面中出现，例如，错误报告。<br />
#<br />
ServerAdmin chenyl98@mails.tsinghua.edu.cn</p>
<p>#<br />
# ServerName 允许设置主机名。如果与程序获得的不同，主机名将返回客户端。<br />
# （例如，用&#8221;www&#8221;代替主机真实的名字）<br />
#<br />
# 注: 主机名不能随便指定。必须是你的机器有效的DNS名称。否则无法正常工作。<br />
# 如果不能理解，倾向你的网络管理员询问。<br />
# 如果你的主机没有注册DNS名，可在此输入IP地址。<br />
# 此时必须用IP地址来访问。(如, http://123.45.67.89/)<br />
# 这样扔可以完成重新定向的工作。<br />
#<br />
# 127.0.0.1 是TCP/IP的本地环路地址, 通常命名为localhost.<br />
# 机器默认此地置为本身。 如果只是使用Apache来进行本地测试和开发，<br />
# 可使用127.0.0.1 作为服务器名.<br />
#<br />
#ServerName new.host.name</p>
<p>#<br />
# DocumentRoot: 放置服务文档的目录。<br />
# 默认状态下，所有的请求都以这个目录为基础。<br />
# 但是直接符号连接和别名可用于指向其他位置。<br />
#<br />
DocumentRoot &#8220;D:/www_root&#8221;</p>
<p>#<br />
# Apache访问的每个目录可设置相关的服务和特性是允许或（和）不允许。<br />
# (同样影响其子目录）<br />
#<br />
# 首先，设置&#8221;default&#8221;地址只有最基本的权限。<br />
#<br />
<Directory /><br />
    Options FollowSymLinks<br />
    AllowOverride None<br />
</Directory></p>
<p>#<br />
# 注意从现在开始必须制定开启特殊的权限。<br />
# 这样就不会产生意想不到的结果。<br />
# 请仔细确认。<br />
#</p>
<p>#<br />
# 这个地址应与DocumentRoot保持一致<br />
#<br />
<Directory "D:/www_root"></p>
<p>#<br />
# 此值可是： &#8220;None&#8221;, &#8220;All&#8221;, 或下列的组合： &#8220;Indexes&#8221;,<br />
# &#8220;Includes&#8221;, &#8220;FollowSymLinks&#8221;, &#8220;ExecCGI&#8221;, 或 &#8220;MultiViews&#8221;.<br />
#<br />
# 注意&#8221;MultiViews&#8221;必须明确指定&#8212; &#8220;Options All&#8221;不包括此特性。<br />
#<br />
    Options Indexes FollowSymLinks MultiViews</p>
<p>#<br />
# 此项控制目录中哪些.htaccess文件可覆盖。<br />
# 允许值： &#8220;All&#8221;或者以下项的组合：&#8221;Options&#8221;, &#8220;FileInfo&#8221;,<br />
# &#8220;AuthConfig&#8221;, &#8220;Limit&#8221;<br />
#<br />
    AllowOverride None</p>
<p>#<br />
# 控制哪些用户可从此服务器获得资料。<br />
#<br />
    Order allow,deny<br />
    Allow from all<br />
</Directory></p>
<p>#<br />
# UserDir: 当请求~user时，追加到用户主目录的路径地址。<br />
#<br />
# 在Win32下，并不要求指定为用户登陆的主目录。<br />
# 因此可使用以下的格式。<br />
# 详细参照文档UserDir<br />
#<br />
<IfModule mod_userdir.c><br />
    UserDir &#8220;f:/homepages/&#8221;<br />
</IfModule></p>
<p>#<br />
# 控制访问UserDir目录.  The following is an example<br />
# 以下是一个站点的例子，权限限制为只读。<br />
#<br />
#<Directory "E:/Program Files/Apache Group/Apache/users"><br />
#    AllowOverride FileInfo AuthConfig Limit<br />
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec<br />
#    <Limit GET POST OPTIONS PROPFIND><br />
#        Order allow,deny<br />
#        Allow from all<br />
#    </Limit><br />
#    <LimitExcept GET POST OPTIONS PROPFIND><br />
#        Order deny,allow<br />
#        Deny from all<br />
#    </LimitExcept><br />
#</Directory></p>
<p>#<br />
# DirectoryIndex: 预设的HTML目录索引文件名。<br />
# 用空格来分隔多个文件名。<br />
#<br />
<IfModule mod_dir.c><br />
    DirectoryIndex index.html<br />
</IfModule></p>
<p>#<br />
# AccessFileName: 每个目录中用于控制访问信息的文件名。<br />
#<br />
AccessFileName .htaccess</p>
<p>#<br />
# 以下行防止客户端可访问 .htaccess 文件。<br />
# 因为 .htaccess文件通常包含授权信息，<br />
# 处于安全的考虑不允许访问。<br />
# 如果想让访客看到.htaccess文件的内容，<br />
# 可将这些行注释。<br />
# 如果修改了上面的AccessFileName,<br />
# 请在此进行相应的修改。<br />
#<br />
# 同时，一般会用类似.htpasswd的文件保存密码。<br />
# 这些文件同样可以得到保护。<br />
#<br />
<Files ~ "^\.ht"><br />
    Order allow,deny<br />
    Deny from all<br />
</Files></p>
<p>#<br />
# CacheNegotiatedDocs: 默认下，Apache对每个文档发送&#8221;Pragma: no-cache&#8221;<br />
# 这将要求代理服务器不缓存此文档。<br />
# 取消下列行的可取消这个属性，这样代理服务器将缓存这些文档。<br />
#<br />
#CacheNegotiatedDocs</p>
<p>#<br />
# UseCanonicalName:  (1.3新增)  当此设置为on时，<br />
# 无论何时Apache需要构建一个自引用的URL(指向响应来源服务器），<br />
# 它将用ServerName和Port来构建一个规范的格式。<br />
# 当此设置为off时，Apache将使用客户端提供的&#8221;主机名：端口&#8221;<br />
# 这将同时影响CGI脚本中的SERVER_NAME和SERVER_PORT<br />
#<br />
UseCanonicalName On</p>
<p>#<br />
# TypesConfig 记录媒体类型（mime.types）文件或类似的东东放置的位置<br />
#<br />
<IfModule mod_mime.c><br />
    TypesConfig conf/mime.types<br />
</IfModule></p>
<p>#<br />
# DefaultType 是服务器处理未确认类型的文件，如为止的扩展名，的默认类型。<br />
# 如果你的服务器上主要包含的是文本或HTML文档，&#8221;text/plain&#8221;是较好的设置<br />
# 如果服务器上主要包含二进制文件，如应用程序或图片，<br />
# 最好设置成&#8221;application/octet-stream&#8221;防止浏览器将二进制文件以文本的方式显示。<br />
#<br />
DefaultType text/plain</p>
<p>#<br />
# mod_mime_magic模块允许服务器使用文件自身的不同标识来确定文件类型。<br />
# MIMEMagicFile指示模块文件标识的定义所在的位置。<br />
# mod_mime_magic不是默认服务器的一部分。<br />
# (必须自行用LoadModule来追加 [见'全局环境'部分的 DSO 章节],<br />
# 或者在编译服务器时包含mod_mime_magic部分）<br />
# 包含在 <IfModule> 中.<br />
# 就是说，如果该模块是服务器的一部分，MIMEMagicFile标识将执行。<br />
#<br />
<IfModule mod_mime_magic.c><br />
    MIMEMagicFile conf/magic<br />
</IfModule></p>
<p>#<br />
# HostnameLookups: 注册客户端的机器名或IP地址。<br />
# 例如： www.apache.org (on) 或 204.62.129.132 (off).<br />
# 默认为off，因为对于网络来说，最好让人们有意识的设置为on，<br />
# 因为开启此功能意味着每个客户请求将导致至少向name服务器发送一个lookup请求<br />
#<br />
HostnameLookups Off</p>
<p>#<br />
# ErrorLog: 错误记录文件的地址<br />
# 如果不在<VirtualHost>内指定ErrorLog<br />
# 改虚拟主机的错误心细将记录到此处。<br />
# 如果在<VirtualHost>中明确指定了错误记录文件，<br />
# 则错误将记录在那儿而不是这儿。<br />
#<br />
ErrorLog logs/error.log</p>
<p>#<br />
# LogLevel: 控制记录在error.log中信息的个数.<br />
# 可能的值：debug, info, notice, warn, error, crit,<br />
# alert, emerg.<br />
#<br />
LogLevel warn</p>
<p>#<br />
# 以下标识定义CustomLog标识使用的格式。（见下）<br />
#<br />
LogFormat &#8220;%h %l %u %t \&#8221;%r\&#8221; %>s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221;" combined<br />
LogFormat &#8220;%h %l %u %t \&#8221;%r\&#8221; %>s %b&#8221; common<br />
LogFormat &#8220;%{Referer}i -> %U&#8221; referer<br />
LogFormat &#8220;%{User-agent}i&#8221; agent</p>
<p>#<br />
# 访问记录的位置和格式 (功用的记录文件格式).<br />
# 如果不在<VirtualHost>中定义记录文件，<br />
# 那些访问记录就将保存在这儿。  Contrariwise, if you *do*<br />
# 反之，如果指定了记录文件，那么访问记录将记录在那儿而不是这个文件中。<br />
#<br />
CustomLog logs/access.log common</p>
<p>#<br />
# 如果希望使用代理和参考的记录文件, 取消以下标识的注释符<br />
#<br />
#CustomLog logs/referer.log referer<br />
#CustomLog logs/agent.log agent</p>
<p>#<br />
# 如果想在一个文件中记录访问、代理、参考信息（复合的记录格式）<br />
# 可使用以下标识<br />
#<br />
#CustomLog logs/access.log combined</p>
<p>#<br />
# 在服务器产生的页面（如错误文档信息，FTP目录列表等等，不包括CGI产生的文档）中<br />
# 增加一条服务器版本和虚拟主机名的信息。<br />
# 设置为&#8221;EMail&#8221;将包含mailto: ServerAdmin的连接.<br />
# 可选值:  On | Off | EMail<br />
#<br />
ServerSignature On</p>
<p>#<br />
# 默认下，Apache用工作行解析所有CGI脚本<br />
# 此注释行（脚本的第一行）包括&#8217;#'和&#8217;!'后面跟着执行特殊脚本的程序路径，<br />
# 对perl脚本来说是C:\Program Files\Perl目录中的perl.exe。<br />
# 工作行如下：</p>
<p>   #!c:/program files/perl/perl</p>
<p># 注意真实的工作行不能有缩进，必须是文件的第一行。<br />
# 当然，CGI进程必须通过适当的scriptAlias或ExecCGI选项标识来启动。<br />
#<br />
# 然而，Windows下的Apache即允许以上的Unix方式，也可以通过注册表的形式。<br />
# 用注册表执行文件的方法同在Windows资源管理器中双击运行的注册方法相同。<br />
# 此脚本操作可在Windows资源管理器的“查看”菜单中设置。<br />
# “文件夹选项”，然后查看“文件类型”。点击编辑按钮。<br />
# 修改操作属性。Apache 1.3会尝试执行‘Open&#8217;操作，<br />
# 如果失败则会尝试工作行<br />
# 这个属性在Apache release 2.0中会有改变.<br />
#<br />
# 每个机制都有自身特定的安全弱点，这样可能导致别人运行你不希望调用的程序。<br />
# 最佳的解决方案还在讨论中。<br />
#<br />
# 要是这个Windows的特殊属性生效 (同时会是Unix属性无效）<br />
# 取消下列标识的注释符。<br />
#<br />
#scriptInterpreterSource registry<br />
#<br />
# 上面的标识可在<Directory>块或.htaccess文件中单独替换。<br />
# 可选择&#8217;registry&#8217; (Windows behavior)或 &#8216;script&#8217;<br />
# (Unix behavior) option, 将覆盖服务器的默认值。<br />
#</p>
<p>#<br />
# Aliases: 可无限制的追加别名。格式如下：<br />
# Alias 假名 真名<br />
#<br />
<IfModule mod_alias.c></p>
<p>    #<br />
    # 注意如果假名中包含&#8217;/'，服务器会在当前URL中发出请求。<br />
    # 因此&#8221;/icons&#8221;不能用于别名<br />
    # 必须用 &#8220;/icons/&#8221;..<br />
    #<br />
    Alias /icons/ &#8220;C:/Program Files/Apache Group/Apache/icons/&#8221;</p>
<p>    <Directory "C:/Program Files/Apache Group/Apache/icons"><br />
        Options Indexes MultiViews<br />
        AllowOverride None<br />
        Order allow,deny<br />
        Allow from all<br />
    </Directory></p>
<p>    #<br />
    # scriptAlias: 控制哪个目录包含服务器脚本。<br />
    # scriptAlias本质行和Aliases一样。, except that<br />
    # 区别在于真名目录中的文档被看作是一个应用程序。<br />
    # 请求时由服务器运行而不是发往客户端。<br />
    # &#8220;/&#8221;符号的规则同<br />
    # Alias相同.<br />
    #<br />
    scriptAlias /cgi-bin/ &#8220;C:/Program Files/Apache Group/Apache/cgi-bin/&#8221;</p>
<p>    #<br />
    # &#8220;C:/Program Files/Apache Group/Apache/cgi-bin&#8221; 可修改为任何放置CGI脚本的目录<br />
    #<br />
    <Directory "C:/Program Files/Apache Group/Apache/cgi-bin"><br />
        AllowOverride None<br />
        Options None<br />
        Order allow,deny<br />
        Allow from all<br />
    </Directory></p>
<p></IfModule><br />
# 别名结束</p>
<p>#php脚本说明</p>
<p>scriptAlias /php/ &#8220;d:/php/&#8221;<br />
AddType application/x-httpd-php .php<br />
AddType application/x-httpd-php .php3<br />
AddType application/x-httpd-php .phtml<br />
Action application/x-httpd-php &#8220;/php/php.exe&#8221;</p>
<p>#php脚本说明结束</p>
<p>#<br />
# Redirect 允许告诉客户端服务器上曾经有的文档，但是现在不存在了。<br />
# 并且可以告诉客户端到哪儿去寻找。<br />
# 格式: Redirect old-URL new-URL<br />
#</p>
<p>#<br />
# 控制服务器目录列表显示的标识<br />
#<br />
<IfModule mod_autoindex.c></p>
<p>    #<br />
    # FancyIndexing标识是使用特定的目录检索还是标准的（standard）<br />
    #<br />
    IndexOptions FancyIndexing</p>
<p>    #<br />
    # AddIcon*表明不同文件或扩展名显示的图标。<br />
    # 这些图标只在特定检索状态下显示。<br />
    #<br />
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip</p>
<p>    AddIconByType (TXT,/icons/text.gif) text/*<br />
    AddIconByType (IMG,/icons/image2.gif) image/*<br />
    AddIconByType (SND,/icons/sound2.gif) audio/*<br />
    AddIconByType (VID,/icons/movie.gif) video/*</p>
<p>    AddIcon /icons/binary.gif .bin .exe<br />
    AddIcon /icons/binhex.gif .hqx<br />
    AddIcon /icons/tar.gif .tar<br />
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv<br />
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip<br />
    AddIcon /icons/a.gif .ps .ai .eps<br />
    AddIcon /icons/layout.gif .html .shtml .htm .pdf<br />
    AddIcon /icons/text.gif .txt<br />
    AddIcon /icons/c.gif .c<br />
    AddIcon /icons/p.gif .pl .py<br />
    AddIcon /icons/f.gif .for<br />
    AddIcon /icons/dvi.gif .dvi<br />
    AddIcon /icons/uuencoded.gif .uu<br />
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl<br />
    AddIcon /icons/tex.gif .tex<br />
    AddIcon /icons/bomb.gif core</p>
<p>    AddIcon /icons/back.gif ..<br />
    AddIcon /icons/hand.right.gif README<br />
    AddIcon /icons/folder.gif ^^DIRECTORY^^<br />
    AddIcon /icons/blank.gif ^^BLANKICON^^</p>
<p>    #<br />
    # DefaultIcon 用于为制定图标的文件所显示的图标。<br />
    #<br />
    DefaultIcon /icons/unknown.gif</p>
<p>    #<br />
    # AddDescription在服务器生成的检索的某个文件后追加小段说明。<br />
    # 此项只在设置为FancyIndexed时有效<br />
    # 格式：AddDescription &#8220;描述&#8221; 文件名<br />
    #<br />
    #AddDescription &#8220;GZIP compressed document&#8221; .gz<br />
    #AddDescription &#8220;tar archive&#8221; .tar<br />
    #AddDescription &#8220;GZIP compressed tar archive&#8221; .tgz</p>
<p>    #<br />
    # ReadmeName是服务器默认的README文件。<br />
    # 并且会追加到目录列表的最后。<br />
    #<br />
    # HeaderName 是目录中需要预先显示内容的文件名。<br />
    #<br />
    # 如果MultiViews在选项中，作为结果，服务器将先找name.html，<br />
    # 如果存在就包含它。如果name.html不存在，<br />
    # 服务器会继续寻找name.txt。如果存在就作为纯文本包含进来。<br />
    #<br />
    ReadmeName README<br />
    HeaderName HEADER</p>
<p>    #<br />
    # IndexIgnore是一系列的文件名。目录索引将忽略这些文件并且不包含在列表中。<br />
    # 允许使用通配符。<br />
    #<br />
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t</p>
<p></IfModule><br />
# indexing标识结束</p>
<p>#<br />
# 文件类型<br />
#<br />
<IfModule mod_mime.c></p>
<p>    #<br />
    # AddEncoding 可用于特殊浏览器(Mosaic/X 2.1+)快速传输压缩信息。<br />
    # 注：并不是所有的服务器都支持。<br />
    # 除了名字相似，以下Add*标识对上面的FancyIndexing定制标识无影响。<br />
    #<br />
    AddEncoding x-compress Z<br />
    AddEncoding x-gzip gz tgz<br />
    #<br />
    # AddLanguage用于指定文档的语言。<br />
    # 可以使用content标签指定每个文件的语言。<br />
    #<br />
    # 注 1: 后缀不必与所用语言的关键字相同。<br />
    #   &#8212; 波兰语（Polish，标准代码为pl）的文档可以用<br />
    #  &#8220;AddLanguage pl .po&#8221; 来避免与perl脚本文件混淆。<br />
    #<br />
    # 注 2: 以下例子表明两个字母的语言缩写和两个字母的国家缩写并不一定相同。<br />
    # E.g. &#8216;Danmark/dk&#8217; 对比 &#8216;Danish/da&#8217;.<br />
    #<br />
    # 注 3: 其中&#8217;ltz&#8217;使用了三个字符，与RFC的规定不同。<br />
    # 但是这个问题正在修订中，并且重新清理RFC1766<br />
    #<br />
    # 丹麦Danish (da) &#8211; 荷兰Dutch (nl) &#8211; 英国English (en) &#8211; 爱萨尼亚Estonian (ee)<br />
    # 法国French (fr) &#8211; 德国German (de) &#8211; 现代希腊文Greek-Modern (el)<br />
    # 意大利Italian (it) &#8211; 朝鲜Korean (kr) &#8211; 挪威Norwegian (no)<br />
    # 葡萄牙Portuguese (pt) &#8211; 卢森堡Luxembourgeois* (ltz)<br />
    # 西班牙Spanish (es) &#8211; 瑞典Swedish (sv) &#8211; 加泰罗尼亚Catalan (ca) &#8211; 捷克Czech(cz)<br />
    # 波兰Polish (pl) &#8211; 巴西Brazilian Portuguese (pt-br) &#8211; 日本Japanese (ja)<br />
    # 俄国Russian (ru)<br />
    #<br />
    AddLanguage da .dk<br />
    AddLanguage nl .nl<br />
    AddLanguage en .en<br />
    AddLanguage et .ee<br />
    AddLanguage fr .fr<br />
    AddLanguage de .de<br />
    AddLanguage el .el<br />
    AddLanguage he .he<br />
    AddCharset ISO-8859-8 .iso8859-8<br />
    AddLanguage it .it<br />
    AddLanguage ja .ja<br />
    AddCharset ISO-2022-JP .jis<br />
    AddLanguage kr .kr<br />
    AddCharset ISO-2022-KR .iso-kr<br />
    AddLanguage no .no<br />
    AddLanguage pl .po<br />
    AddCharset ISO-8859-2 .iso-pl<br />
    AddLanguage pt .pt<br />
    AddLanguage pt-br .pt-br<br />
    AddLanguage ltz .lu<br />
    AddLanguage ca .ca<br />
    AddLanguage es .es<br />
    AddLanguage sv .se<br />
    AddLanguage cz .cz<br />
    AddLanguage ru .ru<br />
    AddLanguage tw .tw<br />
    AddCharset Big5         .Big5    .big5<br />
    AddCharset WINDOWS-1251 .cp-1251<br />
    AddCharset CP866        .cp866<br />
    AddCharset ISO-8859-5   .iso-ru<br />
    AddCharset KOI8-R       .koi8-r<br />
    AddCharset UCS-2        .ucs2<br />
    AddCharset UCS-4        .ucs4<br />
    AddCharset UTF-8        .utf8</p>
<p>    # LanguagePriority 可设置语言的优先级。<br />
    #<br />
    # 优先级降序排列<br />
    # 在此处按照字母顺序，可自行修改<br />
    #<br />
    <IfModule mod_negotiation.c><br />
        LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw<br />
    </IfModule></p>
<p>    #<br />
    # AddType 可临时改变mime.types或者指定特殊文件的格式。<br />
    #<br />
    # 例如：PHP 3.x 模块 (非Apache标准配件，参见http://www.php.net)可用下面格式定义：<br />
    #<br />
    #AddType application/x-httpd-php3 .php3<br />
    #AddType application/x-httpd-php3-source .phps<br />
    #<br />
    # PHP 4.x, 使用:<br />
    #<br />
    #AddType application/x-httpd-php .php<br />
    #AddType application/x-httpd-php-source .phps</p>
<p>    AddType application/x-tar .tgz</p>
<p>    #<br />
    # AddHandler 可将特定文件扩展名映射到处理方法上。<br />
    # 与文件类型无关。此特性可内建到服务器中或者追加在操作指令中（见下）<br />
    #<br />
    # 如果希望用服务器端应用或scriptAliased外的CGI，取消以下行的注释符<br />
    #<br />
    # 用CGI脚本:<br />
    #<br />
    #AddHandler cgi-script .cgi</p>
<p>    #<br />
    # 用服务器解析的HTML文档<br />
    #<br />
    #AddType text/html .shtml<br />
    #AddHandler server-parsed .shtml</p>
<p>    #<br />
    # 取消以下注释符可激活Apache的send-asis HTTP file特性<br />
    #<br />
    #AddHandler send-as-is asis</p>
<p>    #<br />
    # 如果使用服务器端解析的图像定位文件，使用以下标识：<br />
    #<br />
    #AddHandler imap-file map</p>
<p>    #<br />
    # 要激活type maps使用：<br />
    #<br />
    #AddHandler type-map var</p>
<p></IfModule><br />
# 文档类型说明结束</p>
<p>#<br />
# Action 定义在文件匹配时执行相应的脚本。<br />
# 可简化常用CGI文件的调用。<br />
# 格式: Action media/type /cgi-script/location<br />
# 格式: Action handler-name /cgi-script/location<br />
#</p>
<p>#<br />
# MetaDir: 指定保存meta信息文件的目录。<br />
# 这些文件包含附加的HTTP头，在发送文档是一并发送。<br />
#<br />
#MetaDir .web</p>
<p>#<br />
# MetaSuffix: 指定包含meta信息的文件的后缀。<br />
#<br />
#MetaSuffix .meta</p>
<p>#<br />
# 可定制的错误响应(Apache类型)<br />
#  共三种风格：<br />
#<br />
#    1) 纯文本<br />
#ErrorDocument 500 &#8220;The server made a boo boo.<br />
#  注： 第一个&#8221;号用于表示是文本，实际不输出<br />
#<br />
#    2) 本地重定向<br />
#ErrorDocument 404 /missing.html<br />
#  to redirect to local URL /missing.html<br />
#ErrorDocument 404 /cgi-bin/missing_handler.pl<br />
#  注：可重定向到任何一个服务器端的脚本或文档<br />
#<br />
#    3) 外部重定向<br />
#ErrorDocument 402 http://some.other_server.com/subscription_info.html<br />
#  注: 大部分与初始请求关联的环境变量对这样的脚本无效。<br />
#</p>
<p>#<br />
# 基于浏览器的定制操作<br />
#<br />
<IfModule mod_setenvif.c></p>
<p>    #<br />
    # 以下标识修改普通的HTTP响应操作。<br />
    # 第一个标识针对Netscape2.x和其他无此功能的浏览器取消保持激活状态的功能<br />
    # 这些浏览器在执行这些功能时会出错。<br />
    # 第二个标识针对IE4.0b2设置。其中有一条不完整的HTTP/1.1指令<br />
    # 在301或302（重定向）响应时不能正确的保持激活状态<br />
    #<br />
    BrowserMatch &#8220;Mozilla/2&#8243; nokeepalive<br />
    BrowserMatch &#8220;MSIE 4\.0b2;&#8221; nokeepalive downgrade-1.0 force-response-1.0</p>
<p>    #<br />
    # 下面的标识通过不产生基本的1.1响应取消对违反HTTP/1.0标准的浏览器的响应。<br />
    #<br />
    BrowserMatch &#8220;RealPlayer 4\.0&#8243; force-response-1.0<br />
    BrowserMatch &#8220;Java/1\.0&#8243; force-response-1.0<br />
    BrowserMatch &#8220;JDK/1\.0&#8243; force-response-1.0</p>
<p></IfModule><br />
# 浏览器定制标识结束</p>
<p>#<br />
# 允许使用URL&#8221;http://servername/server-status&#8221;的形式查看服务器状态报告<br />
# 修改 &#8220;.your_domain.com&#8221;来匹配相应的域名以激活此功能<br />
#<br />
#<Location /server-status><br />
#    SetHandler server-status<br />
#    Order deny,allow<br />
#    Deny from all<br />
#    Allow from .your_domain.com<br />
#</Location></p>
<p>#<br />
# 允许使用URL&#8221;://servername/server-info&#8221;（要求加载mod_info.c），<br />
# 来远程察看服务器配置报告。<br />
# 修改 &#8220;.your_domain.com&#8221;来匹配相应的域名以激活此功能<br />
#<br />
#<Location /server-info><br />
#    SetHandler server-info<br />
#    Order deny,allow<br />
#    Deny from all<br />
#    Allow from .your_domain.com<br />
#</Location></p>
<p>#<br />
# 据报有人试图利用一个老的1.1漏洞。<br />
# 这个漏洞与CGI脚本在Apache服务器上分布有关。<br />
# 通过取消下面几行的注释符，可以将此类攻击记录转移到phf.apache.org上的记录脚本上。<br />
# 或者也可以利用脚本scriptsupport/phf_abuse_log.cgi记录在本地服务器上。<br />
#<br />
#<Location /cgi-bin/phf*><br />
#    Deny from all<br />
#    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi<br />
#</Location></p>
<p>#<br />
# 代理服务器标识。取消下列行的注释符可激活代理服务器。<br />
#<br />
#<IfModule mod_proxy.c><br />
#    ProxyRequests On</p>
<p>#    <Directory proxy:*><br />
#        Order deny,allow<br />
#        Deny from all<br />
#        Allow from .your_domain.com<br />
#    </Directory></p>
<p>    #<br />
    # 激活/取消处理HTTP/1.1 &#8220;Via:&#8221; 报头<br />
    # (&#8220;Full&#8221;：加入服务器版本; &#8220;Block&#8221;：取消所有外发的Via: 报头)<br />
    # 可设置值: Off | On | Full | Block<br />
    #<br />
#    ProxyVia On</p>
<p>    #<br />
    # 可修改下列各行并取消注释符来激活缓存。<br />
    # (没有CacheRoot标识就不使用缓存)<br />
    #<br />
#    CacheRoot &#8220;E:/Program Files/Apache Group/Apache/proxy&#8221;<br />
#    CacheSize 5<br />
#    CacheGcInterval 4<br />
#    CacheMaxExpire 24<br />
#    CacheLastModifiedFactor 0.1<br />
#    CacheDefaultExpire 1<br />
#    NoCache a_domain.com another_domain.edu joes.garage_sale.com</p>
<p>#</IfModule><br />
# 代理标识结束</p>
<p>### 部分 3: 虚拟主机<br />
#<br />
# 虚拟主机: 如果希望在一台服务器上实现多个域名和主机名的服务，<br />
# 可设置VirtualHost来实现。Most configurations<br />
# 大部分的设置使用基于名称的虚拟主机，这样服务器就不必为IP地址操心。<br />
# 这些用星号在下面的标识中标出。<br />
#<br />
# 在试图设置虚拟主机前<br />
# 请阅读<URL:http://www.apache.org/docs/vhosts/>中的文档。<br />
# 以了解细节问题。<br />
#<br />
# 可用命令行参数 &#8216;-S&#8217;来确认虚拟主机的设置。<br />
#</p>
<p>#<br />
# 使用基于名称的虚拟主机<br />
#<br />
#NameVirtualHost *</p>
<p>#<br />
# 虚拟主机实例:<br />
# 几乎所有的Apache标识都可用于虚拟主机内。<br />
# 第一个VirtualHost部分用于申请一个无重复的服务器名。<br />
#<br />
#<VirtualHost *><br />
#    ServerAdmin webmaster@dummy-host.example.com<br />
#    DocumentRoot /www/docs/dummy-host.example.com<br />
#    ServerName dummy-host.example.com<br />
#    ErrorLog logs/dummy-host.example.com-error_log<br />
#    CustomLog logs/dummy-host.example.com-access_log common<br />
#</VirtualHost></p>
<p>详见 <a href="http://www.jgcao.com/doc/httpd.conf" target="_blank">这里</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3apache%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>理解nginx配置</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3nginx%e9%85%8d%e7%bd%ae/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3nginx%e9%85%8d%e7%bd%ae/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 02:20:18 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=837</guid>
		<description><![CDATA[#运行用户 user nobody nobody; #启动进程 worker_processes 2; #制定进程到cpu（四cpu：0001 0010 0100 1000） worker_cpu_affinity 0001 0010 0100 1000 0001 0010 0100 1000; #每个进程最大打开文件数 worker_rlimit_nofile 10240; #进程号保存文件 pid logs/nginx.pid; #全局错误日志及PID文件 error_log logs/error.log notice; #工作模式及连接数上限 events { #使用epoll（linux2.6的高性能方式） use epoll; #每个进程最大连接数（最大连接=连接数x进程数） worker_connections 10240; } #设定http服务器，利用它的反向代理功能提供负载均衡支持 http { #设定mime类型 include conf/mime.types; #默认文件类型 default_type application/octet-stream; #设定日志格式 log_format main &#8216;$remote_addr &#8211; $remote_user [...]]]></description>
			<content:encoded><![CDATA[<p>#运行用户<br />
user  nobody nobody;</p>
<p>#启动进程<br />
worker_processes  2;</p>
<p>#制定进程到cpu（四cpu：0001 0010 0100 1000）<br />
worker_cpu_affinity 0001 0010 0100 1000 0001 0010 0100 1000;</p>
<p>#每个进程最大打开文件数<br />
worker_rlimit_nofile 10240;</p>
<p>#进程号保存文件<br />
pid        logs/nginx.pid;</p>
<p>#全局错误日志及PID文件<br />
error_log  logs/error.log notice;</p>
<p>#工作模式及连接数上限<br />
events {<br />
#使用epoll（linux2.6的高性能方式）<br />
use epoll;<br />
#每个进程最大连接数（最大连接=连接数x进程数）<br />
worker_connections  10240;<br />
}</p>
<p>#设定http服务器，利用它的反向代理功能提供负载均衡支持<br />
http {<br />
#设定mime类型<br />
include       conf/mime.types;</p>
<p>#默认文件类型<br />
default_type  application/octet-stream;</p>
<p>#设定日志格式<br />
log_format main  &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8216;<br />
&#8216;&#8221;$request&#8221; $status $bytes_sent &#8216;<br />
&#8216;&#8221;$http_referer&#8221; &#8220;$http_user_agent&#8221; &#8216;<br />
&#8216;&#8221;$gzip_ratio&#8221;&#8216;;</p>
<p>log_format download &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8216;<br />
&#8216;&#8221;$request&#8221; $status $bytes_sent &#8216;<br />
&#8216;&#8221;$http_referer&#8221; &#8220;$http_user_agent&#8221; &#8216;<br />
&#8220;$http_range&#8221; &#8220;$sent_http_content_range&#8221;&#8216;;</p>
<p>#接收header的缓冲区大小<br />
client_header_buffer_size    1k;<br />
large_client_header_buffers  4 4k;</p>
<p>#开启gzip模块<br />
gzip on;<br />
#最小压缩文件大小<br />
gzip_min_length  1100;<br />
#压缩缓冲区<br />
gzip_buffers     4 8k;<br />
#压缩类型<br />
gzip_types       text/plain;<br />
#压缩比率<br />
gzip_comp_level  9;<br />
#压缩通过代理的所有文件<br />
gzip_proxied     any;<br />
#vary header支持<br />
gzip_vary        on;<br />
#压缩版本（默认1.1，前端为squid2.5使用1.0）<br />
gzip_http_version 1.0;</p>
<p>#输出缓冲区<br />
output_buffers   1 32k;<br />
postpone_output  1460;</p>
<p>#设定access log<br />
access_log  logs/access.log  main;</p>
<p>#客户端发送header超时<br />
client_header_timeout  3m;<br />
#客户端发送内容超时<br />
client_body_timeout    3m;<br />
#客户端发送超时<br />
send_timeout           3m;</p>
<p>#开启高效文件传输模式<br />
sendfile                on;<br />
tcp_nopush              on;<br />
tcp_nodelay             on;</p>
<p>#长链接超时时间<br />
keepalive_timeout  65;</p>
<p>#设定负载均衡的服务器列表<br />
upstream mysvr {<br />
#weigth参数表示权值，权值越高被分配到的几率越大<br />
#本机上的Squid开启3128端口<br />
server 192.168.8.1:3128 weight=5;<br />
server 192.168.8.2:80   weight=1;<br />
server 192.168.8.3:80   weight=6;<br />
}</p>
<p>#设定虚拟主机<br />
server {<br />
listen          80;<br />
server_name     192.168.8.1 www.yejr.com;</p>
<p>charset gb2312;</p>
<p>#设定本虚拟主机的访问日志<br />
access_log  logs/www.yejr.com.access.log  main;</p>
<p>#如果访问 /img/*, /js/*, /css/* 资源，则直接取本地文件，不通过squid<br />
#如果这些文件较多，不推荐这种方式，因为通过squid的缓存效果更好<br />
location ~ ^/(img|js|css)/  {<br />
root    /data3/Html;<br />
expires 24h;<br />
}</p>
<p>#对 &#8220;/&#8221; 启用负载均衡<br />
location / {<br />
proxy_pass      http://mysvr;</p>
<p>proxy_redirect          off;<br />
proxy_set_header        Host $host;<br />
proxy_set_header        X-Real-IP $remote_addr;<br />
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;<br />
client_max_body_size    10m;<br />
client_body_buffer_size 128k;<br />
proxy_connect_timeout   90;<br />
proxy_send_timeout      90;<br />
proxy_read_timeout      90;<br />
proxy_buffer_size       4k;<br />
proxy_buffers           4 32k;<br />
proxy_busy_buffers_size 64k;<br />
proxy_temp_file_write_size 64k;<br />
}</p>
<p>#设定查看Nginx状态的地址<br />
location /NginxStatus {<br />
stub_status             on;<br />
access_log              on;<br />
auth_basic              &#8220;NginxStatus&#8221;;<br />
auth_basic_user_file  conf/htpasswd;<br />
}<br />
}<br />
}</p>
<p>详见 <a href="http://www.jgcao.com/doc/nginx.conf" target="_blank">这里</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3nginx%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>理解 lighttpd 配置</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3-lighttpd-%e9%85%8d%e7%bd%ae/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3-lighttpd-%e9%85%8d%e7%bd%ae/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 03:43:33 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=831</guid>
		<description><![CDATA[配置说明 # lighttpd configuration file # # use it as a base for lighttpd 1.0.0 and above # # $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $ # #### Options you really have to take care of ############### #server.max-fds = 1024 #server.max-connections = 1024 # 最大连接数,大流量网站推荐2048,默认等于 server.max-fds ## modules to load # 设置要加载的module # at [...]]]></description>
			<content:encoded><![CDATA[<p>配置说明</p>
<p># lighttpd configuration file<br />
#<br />
# use it as a base for lighttpd 1.0.0 and above<br />
#<br />
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $<br />
#<br />
#### Options you really have to take care of ###############</p>
<p>#server.max-fds = 1024<br />
#server.max-connections = 1024<br />
# 最大连接数,大流量网站推荐2048,默认等于 server.max-fds</p>
<p>## modules to load<br />
# 设置要加载的module<br />
# at least mod_access and mod_accesslog should be loaded<br />
# all other module should only be loaded if really neccesary<br />
# &#8211; saves some time<br />
# &#8211; saves memory<br />
server.modules  = (<br />
#	&#8220;mod_rewrite&#8221;,         # 重写<br />
#	&#8220;mod_redirect&#8221;,        # 跳转<br />
&#8220;mod_alias&#8221;,<br />
# url别名,指令使文档可以被存储在DocumentRoot以外的本地文件系统中<br />
&#8220;mod_access&#8221;,          # 访问控制，必须存在<br />
#	&#8220;mod_trigger_b4_dl&#8221;,   # 触发器之类的，没试<br />
#	&#8220;mod_auth&#8221;,            # 权限控制<br />
&#8220;mod_status&#8221;,          # 生成服务器状态的Web页面。<br />
#	&#8220;mod_setenv&#8221;,          # 设置环境变量<br />
#	&#8220;mod_fastcgi&#8221;,         # fastcgi<br />
#	&#8220;mod_proxy&#8221;,           # 代理/网关功能支持<br />
#	&#8220;mod_simple_vhost&#8221;,    # 基于域名的虚拟机<br />
#	&#8220;mod_evhost&#8221;,          # 虚拟主机<br />
#	&#8220;mod_userdir&#8221;,         # 用户跟踪<br />
#	&#8220;mod_cgi&#8221;,             # cgi<br />
#	&#8220;mod_compress&#8221;,        # 文件压缩<br />
#	&#8220;mod_ssi&#8221;,             # ssi<br />
#	&#8220;mod_usertrack&#8221;,<br />
# 使用Session跟踪用户(会发送很多Cookie)，以记录用户的点击流<br />
#	&#8220;mod_expire&#8221;,          # 过期,缓存时间<br />
#	&#8220;mod_secdownload&#8221;,     # url加密，可防盗链<br />
#	&#8220;mod_rrdtool&#8221;,         # 绘图<br />
&#8220;mod_accesslog&#8221;	       # 日志文件<br />
)</p>
<p>## A static document-root. For virtual hosting take a look at the<br />
## mod_simple_vhost module.<br />
# 网站根目录<br />
server.document-root = &#8220;/usr/local/lighttpd/service/&#8221;</p>
<p>## where to upload files to, purged daily.<br />
#上传目录<br />
server.upload-dirs = ( &#8220;/usr/local/lighttpd/uploads&#8221; )</p>
<p>## where to send error-messages to<br />
# 错误日志位置<br />
server.errorlog	= &#8220;/usr/local/lighttpd/log/error.log&#8221;</p>
<p># files to check for if &#8230;/ is requested<br />
# 网站Index 索引<br />
index-file.names = ( &#8220;index.php&#8221;, &#8220;index.html&#8221;,<br />
&#8220;index.htm&#8221;, &#8220;default.htm&#8221; )</p>
<p>## set the event-handler (read the performance section in the manual)<br />
# server.event-handler = &#8220;freebsd-kqueue&#8221; # needed on OS X<br />
# Linux环境下epoll系统调用可提高吞吐量<br />
server.event-handler = &#8220;linux-sysepoll&#8221;</p>
<p># mimetype mapping<br />
mimetype.assign             = (<br />
&#8220;.pdf&#8221;          =&gt;      &#8220;application/pdf&#8221;,<br />
&#8220;.sig&#8221;          =&gt;      &#8220;application/pgp-signature&#8221;,<br />
&#8220;.spl&#8221;          =&gt;      &#8220;application/futuresplash&#8221;,<br />
&#8220;.class&#8221;        =&gt;      &#8220;application/octet-stream&#8221;,<br />
&#8220;.ps&#8221;           =&gt;      &#8220;application/postscript&#8221;,<br />
&#8220;.torrent&#8221;      =&gt;      &#8220;application/x-bittorrent&#8221;,<br />
&#8220;.dvi&#8221;          =&gt;      &#8220;application/x-dvi&#8221;,<br />
&#8220;.gz&#8221;           =&gt;      &#8220;application/x-gzip&#8221;,<br />
&#8220;.pac&#8221;          =&gt;      &#8220;application/x-ns-proxy-autoconfig&#8221;,<br />
&#8220;.swf&#8221;          =&gt;      &#8220;application/x-shockwave-flash&#8221;,<br />
&#8220;.tar.gz&#8221;       =&gt;      &#8220;application/x-tgz&#8221;,<br />
&#8220;.tgz&#8221;          =&gt;      &#8220;application/x-tgz&#8221;,<br />
&#8220;.tar&#8221;          =&gt;      &#8220;application/x-tar&#8221;,<br />
&#8220;.zip&#8221;          =&gt;      &#8220;application/zip&#8221;,<br />
&#8220;.mp3&#8243;          =&gt;      &#8220;audio/mpeg&#8221;,<br />
&#8220;.m3u&#8221;          =&gt;      &#8220;audio/x-mpegurl&#8221;,<br />
&#8220;.wma&#8221;          =&gt;      &#8220;audio/x-ms-wma&#8221;,<br />
&#8220;.wax&#8221;          =&gt;      &#8220;audio/x-ms-wax&#8221;,<br />
&#8220;.ogg&#8221;          =&gt;      &#8220;application/ogg&#8221;,<br />
&#8220;.wav&#8221;          =&gt;      &#8220;audio/x-wav&#8221;,<br />
&#8220;.gif&#8221;          =&gt;      &#8220;image/gif&#8221;,<br />
&#8220;.jar&#8221;          =&gt;      &#8220;application/x-java-archive&#8221;,<br />
&#8220;.jpg&#8221;          =&gt;      &#8220;image/jpeg&#8221;,<br />
&#8220;.jpeg&#8221;         =&gt;      &#8220;image/jpeg&#8221;,<br />
&#8220;.png&#8221;          =&gt;      &#8220;image/png&#8221;,<br />
&#8220;.xbm&#8221;          =&gt;      &#8220;image/x-xbitmap&#8221;,<br />
&#8220;.xpm&#8221;          =&gt;      &#8220;image/x-xpixmap&#8221;,<br />
&#8220;.xwd&#8221;          =&gt;      &#8220;image/x-xwindowdump&#8221;,<br />
&#8220;.css&#8221;          =&gt;      &#8220;text/css&#8221;,<br />
&#8220;.html&#8221;         =&gt;      &#8220;text/html&#8221;,<br />
&#8220;.htm&#8221;          =&gt;      &#8220;text/html&#8221;,<br />
&#8220;.js&#8221;           =&gt;      &#8220;text/javascript&#8221;,<br />
&#8220;.asc&#8221;          =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.c&#8221;            =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.cpp&#8221;          =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.log&#8221;          =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.conf&#8221;         =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.text&#8221;         =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.txt&#8221;          =&gt;      &#8220;text/plain&#8221;,<br />
&#8220;.dtd&#8221;          =&gt;      &#8220;text/xml&#8221;,<br />
&#8220;.xml&#8221;          =&gt;      &#8220;text/xml&#8221;,<br />
&#8220;.mpeg&#8221;         =&gt;      &#8220;video/mpeg&#8221;,<br />
&#8220;.mpg&#8221;          =&gt;      &#8220;video/mpeg&#8221;,<br />
&#8220;.mov&#8221;          =&gt;      &#8220;video/quicktime&#8221;,<br />
&#8220;.qt&#8221;           =&gt;      &#8220;video/quicktime&#8221;,<br />
&#8220;.avi&#8221;          =&gt;      &#8220;video/x-msvideo&#8221;,<br />
&#8220;.asf&#8221;          =&gt;      &#8220;video/x-ms-asf&#8221;,<br />
&#8220;.asx&#8221;          =&gt;      &#8220;video/x-ms-asf&#8221;,<br />
&#8220;.wmv&#8221;          =&gt;      &#8220;video/x-ms-wmv&#8221;,<br />
&#8220;.bz2&#8243;          =&gt;      &#8220;application/x-bzip&#8221;,<br />
&#8220;.tbz&#8221;          =&gt;      &#8220;application/x-bzip-compressed-tar&#8221;,<br />
&#8220;.tar.bz2&#8243;      =&gt;      &#8220;application/x-bzip-compressed-tar&#8221;,<br />
# default mime type<br />
&#8220;&#8221;              =&gt;      &#8220;application/octet-stream&#8221;,<br />
)</p>
<p># Use the &#8220;Content-Type&#8221; extended attribute to obtain mime type if possible<br />
#mimetype.use-xattr = &#8220;enable&#8221;</p>
<p>## send a different Server: header<br />
## be nice and keep it at lighttpd<br />
# server.tag = &#8220;lighttpd&#8221;</p>
<p>#### accesslog module<br />
# 访问日志, 以及日志格式 (combined), 使用X-Forwarded-For可越过代理读取真实ip<br />
accesslog.filename = &#8220;/usr/local/lighttpd/log/access.log&#8221;<br />
#accesslog.format = &#8220;%{X-Forwarded-For}i %v %u %t \&#8221;%r\&#8221; %s %b \&#8221;%{User-Agent}i\&#8221; \&#8221;%{Referer}i\&#8221;"</p>
<p>## deny access the file-extensions<br />
#<br />
# ~    is for backupfiles from vi, emacs, joe, &#8230;<br />
# .inc is often used for code includes which should in general not be part<br />
#      of the document-root<br />
# 设置禁止访问的文件扩展名<br />
url.access-deny = ( &#8220;~&#8221;, &#8220;.inc&#8221; )</p>
<p>$HTTP["url"] =~ &#8220;\.pdf$&#8221; {<br />
server.range-requests = &#8220;disable&#8221;<br />
}</p>
<p>##<br />
# which extensions should not be handle via static-file transfer<br />
#<br />
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi<br />
static-file.exclude-extensions = ( &#8220;.php&#8221;, &#8220;.pl&#8221;, &#8220;.fcgi&#8221; )</p>
<p>######### Options that are good to be but not neccesary to be changed #######</p>
<p>## bind to port (default: 80)<br />
# 端口<br />
#server.port = 81</p>
<p>## bind to localhost (default: all interfaces)<br />
#server.bind = &#8220;127.0.0.1&#8243;</p>
<p>## error-handler for status 404<br />
#server.error-handler-404   = &#8220;/error-handler.html&#8221;<br />
#server.error-handler-404   = &#8220;/error-handler.php&#8221;</p>
<p>## to help the rc.scripts<br />
# 进程id记录位置<br />
#server.pid-file = &#8220;/var/run/lighttpd.pid&#8221;</p>
<p>###### virtual hosts<br />
##<br />
##  If you want name-based virtual hosting add the next three settings and load<br />
##  mod_simple_vhost<br />
##<br />
## document-root =<br />
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot<br />
## or<br />
##   virtual-server-root + http-host + virtual-server-docroot<br />
##<br />
#simple-vhost.server-root   = &#8220;/srv/www/vhosts/&#8221;<br />
#simple-vhost.default-host  = &#8220;www.example.org&#8221;<br />
#simple-vhost.document-root = &#8220;/htdocs/&#8221;</p>
<p>## 错误转向统一处理<br />
## Format: .html<br />
## -&gt; &#8230;./status-404.html for &#8216;File not found&#8217;<br />
#server.errorfile-prefix    = &#8220;/usr/share/lighttpd/errors/status-&#8221;<br />
#server.errorfile-prefix    = &#8220;/srv/www/errors/status-&#8221;</p>
<p>## virtual directory listings<br />
# 如果没有找到index文件，是否显示目录列表。建议disable。<br />
dir-listing.activate  = &#8220;disable&#8221;<br />
## select encoding for directory listings<br />
# 列表字符集<br />
dir-listing.encoding  = &#8220;utf-8&#8243;<br />
####### If the URL is like ^/download/ then enable/disable dir-listing<br />
$HTTP["url"] =~ &#8220;^/download/&#8221; {<br />
dir-listing.activate = &#8220;enable&#8221;<br />
}</p>
<p>## enable debugging<br />
#debug.log-request-header   = &#8220;enable&#8221;<br />
#debug.log-response-header  = &#8220;enable&#8221;<br />
#debug.log-request-handling = &#8220;enable&#8221;<br />
#debug.log-file-not-found   = &#8220;enable&#8221;</p>
<p>### only root can use these options<br />
#<br />
# chroot() to directory (default: no chroot() )<br />
#server.chroot = &#8220;/&#8221;</p>
<p># 服务运行使用的用户及用户组<br />
## change uid to  (default: don&#8217;t care)<br />
#server.username = &#8220;wwwrun&#8221;</p>
<p>## change uid to  (default: don&#8217;t care)<br />
#server.groupname = &#8220;wwwrun&#8221;</p>
<p># gzip压缩存放的目录以及需要压缩的文件类型<br />
#### compress module<br />
#compress.cache-dir = &#8220;/var/cache/lighttpd/compress/&#8221;<br />
#compress.filetype = (&#8220;text/plain&#8221;, &#8220;text/html&#8221;)</p>
<p>#### proxy module<br />
## read proxy.txt for more info<br />
#proxy.server = ( &#8220;.php&#8221; =&gt;<br />
#	( &#8220;localhost&#8221; =&gt;<br />
#		(<br />
#			&#8220;host&#8221; =&gt; &#8220;192.168.0.101&#8243;,<br />
#			&#8220;port&#8221; =&gt; 80<br />
#		)<br />
#	)<br />
#)</p>
<p>#### fastcgi module<br />
## read fastcgi.txt for more info<br />
## for PHP don&#8217;t forget to set cgi.fix_pathinfo = 1 in the php.ini<br />
#fastcgi.server = ( &#8220;.php&#8221; =&gt;<br />
#	( &#8220;localhost&#8221; =&gt;<br />
#		(<br />
#			&#8220;socket&#8221; =&gt; &#8220;/var/run/lighttpd/php-fastcgi.socket&#8221;,<br />
#			&#8220;bin-path&#8221; =&gt; &#8220;/usr/local/bin/php-cgi&#8221;<br />
#		)<br />
#	)<br />
#)</p>
<p>#### CGI module<br />
#cgi.assign = ( &#8220;.pl&#8221;  =&gt; &#8220;/usr/bin/perl&#8221;,<br />
#&#8221;.cgi&#8221; =&gt; &#8220;/usr/bin/perl&#8221; )<br />
#</p>
<p>#### SSL engine<br />
#ssl.engine = &#8220;enable&#8221;<br />
#ssl.pemfile = &#8220;/etc/ssl/private/lighttpd.pem&#8221;</p>
<p>#### status module<br />
#status.status-url = &#8220;/server-status&#8221;<br />
#status.config-url = &#8220;/server-config&#8221;<br />
$HTTP["remoteip"] == &#8220;192.168.0.205&#8243; {<br />
status.status-url = &#8220;/server-status&#8221;<br />
}</p>
<p>#### auth module<br />
## read authentication.txt for more info<br />
# 权限控制<br />
#auth.backend = &#8220;plain&#8221;<br />
#auth.backend.plain.userfile = &#8220;lighttpd.user&#8221;<br />
#auth.backend.plain.groupfile = &#8220;lighttpd.group&#8221;</p>
<p>#auth.backend.ldap.hostname = &#8220;localhost&#8221;<br />
#auth.backend.ldap.base-dn  = &#8220;dc=my-domain,dc=com&#8221;<br />
#auth.backend.ldap.filter   = &#8220;(uid=$)&#8221;</p>
<p>#auth.require = ( &#8220;/server-status&#8221; =&gt;<br />
#	(<br />
#		&#8220;method&#8221;  =&gt; &#8220;digest&#8221;,<br />
#		&#8220;realm&#8221;   =&gt; &#8220;download archiv&#8221;,<br />
#		&#8220;require&#8221; =&gt; &#8220;user=jan&#8221;<br />
# 允许的用户, 用户列表文件 在上面配置的auth.backend.htpasswd.userfile 里<br />
#	),<br />
#	&#8220;/server-config&#8221; =&gt;<br />
#	(<br />
#		&#8220;method&#8221;  =&gt; &#8220;digest&#8221;,<br />
#		&#8220;realm&#8221;   =&gt; &#8220;download archiv&#8221;,<br />
#		&#8220;require&#8221; =&gt; &#8220;valid-user&#8221;<br />
#	)<br />
#)</p>
<p>#### url handling modules (rewrite, redirect, access)<br />
# url 重写 (cakephp可用)<br />
#url.rewrite = ( &#8220;^/$&#8221; =&gt; &#8220;/server-status&#8221; )<br />
# url 跳转<br />
#url.redirect = ( &#8220;^/wishlist/(.+)&#8221; =&gt; &#8220;http://www.123.org/$1&#8243; )<br />
#### both rewrite/redirect support back reference to regex conditional using %n<br />
#$HTTP["host"] =~ &#8220;^www\.(.*)&#8221; {<br />
#  url.redirect = ( &#8220;^/(.*)&#8221; =&gt; &#8220;http://%1/$1&#8243; )<br />
#}</p>
<p># 映射<br />
alias.url =  (<br />
&#8220;/only/a/test&#8221; =&gt; &#8220;/usr/local/lighttpd/test&#8221;,<br />
&#8220;/hahaha&#8221; =&gt; &#8220;/usr/local/lighttpd/hahaha&#8221;<br />
)</p>
<p>#<br />
# define a pattern for the host url finding<br />
# %% =&gt; % sign<br />
# %0 =&gt; domain name + tld<br />
# %1 =&gt; tld<br />
# %2 =&gt; domain name without tld<br />
# %3 =&gt; subdomain 1 name<br />
# %4 =&gt; subdomain 2 name<br />
#<br />
#evhost.path-pattern = &#8220;/srv/www/vhosts/%3/htdocs/&#8221;</p>
<p># 基于 evhost 的虚拟主机 针对域名<br />
#$HTTP["host"] == &#8220;a.lostk.com&#8221; {<br />
#server.document-root = &#8220;/var/www/lostk/&#8221;<br />
#server.errorlog = &#8220;/var/log/lighttpd/lostk-error.log&#8221;<br />
#accesslog.filename = &#8220;/var/log/lighttpd/lostk-access.log&#8221;<br />
#}</p>
<p>#### expire module<br />
# 设定文件过期时间(缓存过期时间)<br />
#expire.url = (<br />
&#8220;/buggy/&#8221; =&gt; &#8220;access 2 hours&#8221;,<br />
&#8220;/asdhas/&#8221; =&gt; &#8220;access plus 1 seconds 2 minutes&#8221;<br />
)</p>
<p>#### ssi<br />
#ssi.extension = ( &#8220;.shtml&#8221; )</p>
<p>#### rrdtool<br />
#rrdtool.binary = &#8220;/usr/bin/rrdtool&#8221;<br />
#rrdtool.db-name = &#8220;/var/lib/lighttpd/lighttpd.rrd&#8221;</p>
<p>#### setenv<br />
#setenv.add-request-header  = ( &#8220;TRAV_ENV&#8221; =&gt; &#8220;mysql://user@host/db&#8221; )<br />
#setenv.add-response-header = ( &#8220;X-Secret-Message&#8221; =&gt; &#8220;42&#8243; )</p>
<p>## for mod_trigger_b4_dl<br />
# trigger-before-download.gdbm-filename = &#8220;/var/lib/lighttpd/trigger.db&#8221;<br />
# trigger-before-download.memcache-hosts = ( &#8220;127.0.0.1:11211&#8243; )<br />
# trigger-before-download.trigger-url = &#8220;^/trigger/&#8221;<br />
# trigger-before-download.download-url = &#8220;^/download/&#8221;<br />
# trigger-before-download.deny-url = &#8220;http://127.0.0.1/index.html&#8221;<br />
# trigger-before-download.trigger-timeout = 10</p>
<p>#### variable usage:<br />
## variable name without &#8220;.&#8221; is auto prefixed by &#8220;var.&#8221; and becomes &#8220;var.bar&#8221;<br />
#bar = 1<br />
#var.mystring = &#8220;foo&#8221;</p>
<p>## integer add<br />
#bar += 1<br />
## string concat, with integer cast as string, result: &#8220;www.foo1.com&#8221;<br />
#server.name = &#8220;www.&#8221; + mystring + var.bar + &#8220;.com&#8221;<br />
## array merge<br />
#index-file.names = (foo + &#8220;.php&#8221;) + index-file.names<br />
#index-file.names += (foo + &#8220;.php&#8221;)</p>
<p>#### include<br />
#include /etc/lighttpd/lighttpd-inc.conf<br />
## same as above if you run: &#8220;lighttpd -f /etc/lighttpd/lighttpd.conf&#8221;<br />
#include &#8220;lighttpd-inc.conf&#8221;</p>
<p>#### include_shell<br />
#include_shell &#8220;echo var.a=1&#8243;<br />
## the above is same as:<br />
#var.a=1</p>
<p># 针对端口的虚拟主机<br />
#$SERVER["socket"] == &#8220;192.168.0.1:8000&#8243; {<br />
#	server.document-root = &#8220;/var/www/xxx/&#8221;<br />
#	server.errorlog = &#8220;/var/log/lighttpd/test-error.log&#8221;<br />
#	accesslog.filename = &#8220;/var/log/lighttpd/test-access.log&#8221;<br />
#	&#8230;<br />
#}</p>
<p>详见    <a href="http://www.jgcao.com/doc/lighttpd.conf" target="_blank">这里</a> <a href="http://redmine.lighttpd.net/projects/lighttpd/wiki" target="_blank">官方</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e7%90%86%e8%a7%a3-lighttpd-%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>了解web server（Apache、lighttpd、nginx）</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e4%ba%86%e8%a7%a3web-server%ef%bc%88apache%e3%80%81lighttpd%e3%80%81nginx%ef%bc%89/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e4%ba%86%e8%a7%a3web-server%ef%bc%88apache%e3%80%81lighttpd%e3%80%81nginx%ef%bc%89/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 03:09:51 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=826</guid>
		<description><![CDATA[一、简介 1、lighttpd Lighttpd是一个具有非常低的内存开销，cpu占用率低，效能好，以及丰富的模块等特点。lighttpd是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI， CGI， Auth， 输出压缩(output compress)， URL重写， Alias等重要功能。 Lighttpd使用fastcgi方式运行php，它会使用很少的PHP进程响应很大的并发量。 Fastcgi的优点： （1）、从稳定性上看， fastcgi是以独立的进程池运行来cgi，单独一个进程死掉，系统可以很轻易的丢弃，然后重新分配新的进程来运行逻辑。 （2） 、从安全性上看， fastcgi和宿主的server完全独立， fastcgi怎么down也不会把server搞垮， （3）、从性能上看， fastcgi把动态逻辑的处理从server中分离出来， 大负荷的IO处理还是留给宿主server， 这样宿主server可以一心一意作IO，对于一个普通的动态网页来说， 逻辑处理可能只有一小部分， 大量的图片等静态IO处理完全不需要逻辑程序的参与 （4）、从扩展性上讲， fastcgi是一个中立的技术标准， 完全可以支持任何语言写的处理程序(php，java，python…) 2、apache apache是世界排名第一的web服务器，世界上百分之五十以上的web服务器在使用。 apache 的特性: 1)、 几乎可以运行在所有的计算机平台上。 2) 、支持最新的http/1.1协议 3) 、简单而且强有力的基于文件的配置(httpd.conf)。 4) 、支持通用网关接口(cgi) 5) 、支持虚拟主机。 6) 、支持http认证。 7) 、集成perl。 、集成的代理服务器 9) 、可以通过web浏览器监视服务器的状态， 可以自定义日志。 10) 、支持服务器端包含命令(ssi)。 11) 、支持安全socket层(ssl)。 12) 、具有用户会话过程的跟踪能力。 [...]]]></description>
			<content:encoded><![CDATA[<p>一、简介<br />
1、lighttpd<br />
Lighttpd是一个具有非常低的内存开销，cpu占用率低，效能好，以及丰富的模块等特点。lighttpd是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI， CGI， Auth， 输出压缩(output compress)， URL重写， Alias等重要功能。<br />
Lighttpd使用fastcgi方式运行php，它会使用很少的PHP进程响应很大的并发量。<br />
Fastcgi的优点：<br />
（1）、从稳定性上看， fastcgi是以独立的进程池运行来cgi，单独一个进程死掉，系统可以很轻易的丢弃，然后重新分配新的进程来运行逻辑。</p>
<p>（2） 、从安全性上看， fastcgi和宿主的server完全独立， fastcgi怎么down也不会把server搞垮，<br />
（3）、从性能上看， fastcgi把动态逻辑的处理从server中分离出来， 大负荷的IO处理还是留给宿主server， 这样宿主server可以一心一意作IO，对于一个普通的动态网页来说， 逻辑处理可能只有一小部分， 大量的图片等静态IO处理完全不需要逻辑程序的参与<br />
（4）、从扩展性上讲， fastcgi是一个中立的技术标准， 完全可以支持任何语言写的处理程序(php，java，python…)</p>
<p>2、apache<br />
apache是世界排名第一的web服务器，世界上百分之五十以上的web服务器在使用。<br />
apache 的特性:<br />
1)、 几乎可以运行在所有的计算机平台上。<br />
2) 、支持最新的http/1.1协议<br />
3) 、简单而且强有力的基于文件的配置(httpd.conf)。<br />
4) 、支持通用网关接口(cgi)<br />
5) 、支持虚拟主机。<br />
6) 、支持http认证。<br />
7) 、集成perl。<br />
 <img src='http://jgcao.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> 、集成的代理服务器<br />
9) 、可以通过web浏览器监视服务器的状态， 可以自定义日志。<br />
10) 、支持服务器端包含命令(ssi)。<br />
11) 、支持安全socket层(ssl)。<br />
12) 、具有用户会话过程的跟踪能力。<br />
13) 、支持fastcgi<br />
14) 、支持java servlets</p>
<p>3、nginx<br />
Nginx是俄罗斯人编写的十分轻量级的HTTP服务器，Nginx，它的发音为“engine X”， 是一个高性能的HTTP和反向代理服务器，同时也是一个IMAP/POP3/SMTP 代理服务器．Nginx是由俄罗斯人 Igor Sysoev为俄罗斯访问量第二的 Rambler。ru站点开发。<br />
Nginx以事件驱动的方式编写，所以有非常好的性能，同时也是一个非常高效的反向代理、负载平衡。其拥有匹配 Lighttpd的性能，同时还没有Lighttpd的内存泄漏问题，而且Lighttpd的mod_proxy也有一些问题并且很久没有更新。但是Nginx并不支持cgi方式运行，原因是可以减少因此带来的一些程序上的漏洞。所以必须使用FastCGI方式来执行PHP程序。<br />
nginx做为HTTP服务器，有以下几项基本特性：<br />
1) 、处理静态文件，索引文件以及自动索引；打开文件描述符缓冲．<br />
2) 、无缓存的反向代理加速，简单的负载均衡和容错．<br />
3) 、FastCGI，简单的负载均衡和容错．<br />
4)、 模块化的结构。包括gzipping， byte ranges， chunked responses，以及 SSI-filter等filter。如果由FastCGI或其它代理服务器处理单页中存在的多个SSI，则这项处理可以并行运行，而不需要相互等待。<br />
5)、 Nginx专为性能优化而开发，性能是其最重要的考量，实现上非常注重效率。它支持内核Poll模型，能经受高负载的考验，有报告表明能支持高达 50，000个并发连接数。<br />
6) 、Nginx具有很高的稳定性。其它HTTP服务器，当遇到访问的峰值，或者有人恶意发起慢速连接时，也很可能会导致服务器物理内存耗尽频繁交换，失去响应，只能重启服务器。例如当前apache一旦上到200个以上进程，web响应速度就明显非常缓慢了。而Nginx采取了分阶段资源分配技术，使得它的CPU与内存占用率非常低。nginx官方表示保持10，000个没有活动的连接，它只占2。5M内存，所以类似DOS这样的攻击对nginx来说基本上是毫无用处的。就稳定性而言，nginx比lighthttpd更胜一筹。<br />
7) 、Nginx支持热部署。它的启动特别容易， 并且几乎可以做到7*24不间断运行，即使运行数个月也不需要重新启动。你还能够在不间断服务的情况下，对软件版本进行进行升级。</p>
<p>二、比较：</p>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><strong><span style="color: navy;">server</span></strong></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><strong><span style="color: navy;">Apache</span></strong></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><strong><span style="color: navy;">Nginx </span></strong></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><strong><span style="color: navy;">Lighttpd</span></strong></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">Proxy</span><span style="color: black;">代理</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">Rewriter</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">Fcgi</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">热部署</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不支持</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">支持</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不支持</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">系统压力比较</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">很大</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">很小</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">比较小</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">稳定性</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不好</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">安全性</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">技术支持</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">很少</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">静态文件处理</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">好</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">Vhosts</span><span style="color: black;">虚拟主机</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">支持</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不支持</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">支持</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">反向代理</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">非常好</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">一般</span></p>
</td>
</tr>
<tr>
<td style="font-size: 12px; width: 264px; padding: 0cm;" width="27%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">Session sticky</span></p>
</td>
<td style="font-size: 12px; width: 188px; padding: 0cm;" width="19%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">支持</span></p>
</td>
<td style="font-size: 12px; width: 232px; padding: 0cm;" width="24%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不支持</span></p>
</td>
<td style="font-size: 12px; width: 275px; padding: 0cm;" width="28%" valign="top">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 14px; margin-left: 0px; text-indent: 24pt; text-align: justify;"><span style="color: black;">不支持</span></p>
</td>
</tr>
</tbody>
</table>
<p>注：在相对比较大的网站，节约下来的服务器成本无疑是客观的。而有些小型网站往往服务器不多，如果采用 Apache 这类传统 Web 服务器，似乎也还能撑过去。但有其很明显的弊端： Apache 在处理流量爆发的时候(比如爬虫或者是 Digg 效应) 很容易过载，这样的情况下采用 Nginx 最为合适。<br />
建议方案：<br />
Apache 后台服务器（主要处理php及一些功能请求 如：中文url）<br />
Nginx 前端服务器（利用它占用系统资源少得优势来处理静态页面大量请求）<br />
Lighttpd 图片服务器<br />
总体来说，随着nginx功能得完善将使他成为今后web server得主流。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e4%ba%86%e8%a7%a3web-server%ef%bc%88apache%e3%80%81lighttpd%e3%80%81nginx%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WEB项目三层开发</title>
		<link>http://www.jgcao.com/index.php/2010/03/web%e9%a1%b9%e7%9b%ae%e4%b8%89%e5%b1%82%e5%bc%80%e5%8f%91/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/web%e9%a1%b9%e7%9b%ae%e4%b8%89%e5%b1%82%e5%bc%80%e5%8f%91/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 02:41:38 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[develop]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=823</guid>
		<description><![CDATA[1、表示层(USL：User Show Layer) 主要表示WEB方式，也可以表示成WINFORM方式。如果逻辑层相当强大和完善，无论表现层如何定义和更改，逻辑层都能完善地提供服务。 2、业务逻辑层(BLL： Business Logic Layer) 主要是针对具体的问题的操作，也可以理解成对数据层的操作，对数据业务逻辑处理。如果说数据层是积木，那逻辑层就是对这些积木的搭建。 3、数据访问层(DAL：Data Access Laye) 主要是对原始数据(数据库或者文本文件等存放数据的形式)的操作层，而不是指原始数据，也就是说，是对数据的操作，而不是数据库，具体为业务逻辑层或表示层提供数据服务。]]></description>
			<content:encoded><![CDATA[<p><strong> 1、表示层(USL：User Show Layer)</strong></p>
<p>主要表示WEB方式，也可以表示成WINFORM方式。如果逻辑层相当强大和完善，无论表现层如何定义和更改，逻辑层都能完善地提供服务。</p>
<p><strong>2、业务逻辑层(BLL： Business   Logic   Layer)</strong></p>
<p>主要是针对具体的问题的操作，也可以理解成对数据层的操作，对数据业务逻辑处理。如果说数据层是积木，那逻辑层就是对这些积木的搭建。</p>
<p><strong>3、数据访问层(DAL：Data Access Laye)</strong></p>
<p>主要是对原始数据(数据库或者文本文件等存放数据的形式)的操作层，而不是指原始数据，也就是说，是对数据的操作，而不是数据库，具体为业务逻辑层或表示层提供数据服务。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/web%e9%a1%b9%e7%9b%ae%e4%b8%89%e5%b1%82%e5%bc%80%e5%8f%91/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>学习单元测试工具</title>
		<link>http://www.jgcao.com/index.php/2010/03/%e5%ad%a6%e4%b9%a0%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7/</link>
		<comments>http://www.jgcao.com/index.php/2010/03/%e5%ad%a6%e4%b9%a0%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 10:20:19 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[unitTest]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=818</guid>
		<description><![CDATA[一、PHP单元测试工具 测试用例 二、JavaScript单元测试工具 &#8212; QUnit QUnit是jQuery团队开发的JavaScript单元测试工具，使用方便，界面美观。 //安装测试 test( name, expected, test ) //添加一个测试运行 asyncTest( name, expected, test ) //添加异步测试运行 expect( amount ) //预计在一个测试中有几个断言 module( name, [lifecycle] ) //函数指定测试模块和周期。 init( ) //初始化测试 //断言函数 ok( state, [message] ) //判断函数，只能判断true和false。 equals( actual, expected, [message] ) //相等判断 same( actual, expected, [message] ) //相同判断(包含数组、对象等) //异步测试 start( ) //TestRunner停止后再启动测试 stop( timeout [...]]]></description>
			<content:encoded><![CDATA[<p>一、PHP单元测试工具</p>
<p><a href="http://www.jgcao.com/demo/unittest" target="_blank">测试用例</a></p>
<p>二、JavaScript单元测试工具 &#8212; QUnit</p>
<p>QUnit是jQuery团队开发的JavaScript单元测试工具，使用方便，界面美观。</p>
<pre class="javascript" name="code">

//安装测试
test( name, expected, test ) //添加一个测试运行
asyncTest( name, expected, test ) //添加异步测试运行
expect( amount ) //预计在一个测试中有几个断言
module( name, [lifecycle] ) //函数指定测试模块和周期。
init( ) //初始化测试

//断言函数
ok( state, [message] )  //判断函数，只能判断true和false。
equals( actual, expected, [message] ) //相等判断
same( actual, expected, [message] ) //相同判断(包含数组、对象等)

//异步测试
start( ) //TestRunner停止后再启动测试
stop( timeout ) //停止TestRunner的等待异步测试运行
</pre>
<p>建立一个测试页面，引入 qunit.js 和 qunit.css 这两个必需的文件</p>
<pre class="javascript" name="code">
<h1 id="qunit-header">QUnit example</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</pre>
<p>测试用例</p>
<pre class="javascript" name="code">
//定义测试模块
module( "测试示例" );
//定义一个简单的函数，判断参数是不是数字
function simpleTest(para) {
  if(typeof para == "number") {
    return true;
  }
  else{
    return false;
  }
}
//开始单元测试
test('simpleTest()', function() {
  //列举各种可能的情况，注意使用 ! 保证表达式符合应该的逻辑
  ok(simpleTest(2), '2是一个数字');
  ok(!simpleTest("2"), '"2"不是一个数字');
});

//定义一个简单的函数，返回数字和2的乘积
  function simpleTest1(para) {
    return para * 2;
  }
  //开始单元测试
  test('simpleTest1()', function() {
    //列举各种可能的情况
    equals(simpleTest1(2), 4, '2 * 2 等于 4');
    equals(simpleTest(2), 3, '2 * 2 等于 3');
  });

//定义一个简单的函数，返回一个数组
  function simpleTest2() {
    return [1, 2];
  }
  //开始单元测试
  test('simpleTest2()', function() {
    //列举各种可能的情况
    equals(simpleTest2(), [1, 2], '函数返回数组[1, 2]');
    equals(simpleTest2(), [1, 1], '函数返回数组[1, 1]');
  });

//异步测试
module( "异步测试示例" );
//setTimeout
test('asynchronous test', function() {
  // 暂停测试
  stop();

  setTimeout(function() {
    ok(true, '完成运行');
    //待测试完成后，恢复
    start();
  }, 100)
})
//另一种形式
asyncTest('asynchronous test', function() {
  setTimeout(function() {
    ok(true);
    //待测试完成后，恢复
    start();
  }, 100)
})

//Ajax测试
function ajax(successCallback) {
  $.ajax({
    url: 'server.php',
    success: successCallback
  });
}

test('asynchronous test', function() {
  // 暂停测试
  stop();

  ajax(function() {
    // 异步调用判断
  })

  setTimeout(function() {
    //异步测试完成后，恢复
    start();
  }, 2000);
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/03/%e5%ad%a6%e4%b9%a0%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>理解单元测试主要内容</title>
		<link>http://www.jgcao.com/index.php/2010/02/%e7%90%86%e8%a7%a3%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e4%b8%bb%e8%a6%81%e5%86%85%e5%ae%b9/</link>
		<comments>http://www.jgcao.com/index.php/2010/02/%e7%90%86%e8%a7%a3%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e4%b8%bb%e8%a6%81%e5%86%85%e5%ae%b9/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 05:46:52 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[unitTest]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=810</guid>
		<description><![CDATA[单元测试大多数由开发人员来完成，测试人员技术背景较好或者开发系统软件时可能会安排测试人员进行单元测试，大多数进行的单元测试都是开发人员调试程序或者开发组系统联合调试的过程。 单元测试一般包括五个方面的测试： 一、模块接口测试 模块接口测试是单元测试的基础。只有在数据能正确流入、流出模块的前提下，其他测试才有意义。模块接口测试也是集成测试的重点，这里进行的测试主要是为后面打好基础。 测试接口正确与否应该考虑下列因素： 1、输入的实际参数与形式参数的个数是否相同； 2、输入的实际参数与形式参数的属性是否匹配； 3、输入的实际参数与形式参数的量纲是否一致； 4、调用其他模块时所给实际参数的个数是否与被调模块的形参个数相同； 5、调用其他模块时所给实际参数的属性是否与被调模块的形参属性匹配； 6、调用其他模块时所给实际参数的量纲是否与被调模块的形参量纲一致； 7、调用预定义函数时所用参数的个数、属性和次序是否正确； 8、是否存在与当前入口点无关的参数引用； 9、是否修改了只读型参数； 10、对全程变量的定义各模块是否一致； 11、是否把某些约束作为参数传递。 如果模块功能包括外部输入输出，还应该考虑下列因素： 1、文件属性是否正确； 2、OPEN/CLOSE语句是否正确； 3、格式说明与输入输出语句是否匹配； 4、缓冲区大小与记录长度是否匹配； 5、文件使用前是否已经打开； 6、是否处理了文件尾； 7、是否处理了输入/输出错误； 8、输出信息中是否有文字性错误。 二、局部数据结构测试 检查局部数据结构是为了保证临时存储在模块内的数据在程序执行过程中完整、正确，局部功能是整个功能运行的基础。重点是一些函数是否正确执行，内部是否运行正确。 局部数据结构往往是错误的根源，应仔细设计测试用例，力求发现下面几类错误： 1、不合适或不相容的类型说明；  2、变量无初值；  3、变量初始化或省缺值有错；  4、不正确的变量名（拼错或不正确地截断）；  5、出现上溢、下溢和地址异常。 三、边界条件测试 边界条件测试是单元测试中最重要的一项任务。众所周知，软件经常在边界上失效，采用边界值分析技术，针对边界值及其左、右设计测试用例，很有可能发现新的错误。边界条件测试是一项基础测试，也是后面系统测试中的功能测试的重点，边界测试执行的较好，可以大大提高程序健壮性。 四、模块中所有独立路径测试 在模块中应对每一条独立执行路径进行测试，单元测试的基本任务是保证模块中每条语句至少执行一次。测试目的主要是为了发现因错误计算、不正确的比较和不适当的控制流造成的错误。具体做法就是程序员逐条调试语句。 常见的错误包括： 1、误解或用错了算符优先级；  2、混合类型运算；  3、变量初值错；  4、精度不够；  5、表达式符号错。 比较判断与控制流常常紧密相关，测试时注意下列错误：  1、不同数据类型的对象之间进行比较；  2、错误地使用逻辑运算符或优先级；  3、因计算机表示的局限性，期望理论上相等而实际上不相等的两个量相等；  4、比较运算或变量出错；  5、循环终止条件或不可能出现；  6、迭代发散时不能退出；  7、错误地修改了循环变量。 五、模块的各条错误处理通路测试 程序在遇到异常情况时不应该退出，好的程序应能预见各种出错条件，并预设各种出错处理通路。如果用户不按照正常操作，程序就退出或者停止工作，实际上也是一种缺陷，因此单元测试要测试各种错误处理路径。 一般这种测试着重检查下列问题： 1、输出的出错信息难以理解；  2、记录的错误与实际遇到的错误不相符；  3、在程序自定义的出错处理段运行之前，系统已介入；  4、异常处理不当；  5、错误陈述中未能提供足够的定位出错信息。]]></description>
			<content:encoded><![CDATA[<p>单元测试大多数由开发人员来完成，测试人员技术背景较好或者开发系统软件时可能会安排测试人员进行单元测试，大多数进行的单元测试都是开发人员调试程序或者开发组系统联合调试的过程。</p>
<p>单元测试一般包括五个方面的测试：</p>
<p><strong>一、</strong><span style="line-height: normal !important;"><strong>模块接口测试</strong></span></p>
<p><span style="line-height: normal !important;"> </span>模块接口测试是单元测试的基础。只有在数据能正确流入、流出模块的前提下，其他测试才有意义。模块接口测试也是<span style="line-height: normal !important;"><a style="color: #000000; text-decoration: none; line-height: normal !important;" href="http://www.ltesting.net/html/69/category-catid-469.html" target="_blank">集成测试</a></span>的重点，这里进行的测试主要是为后面打好基础。</p>
<p>测试接口正确与否应该考虑下列因素： <br style="line-height: normal !important;" /><br style="line-height: normal !important;" /><span style="color: #006699;">1、输入的实际参数与形式参数的个数是否相同； </span></p>
<p><span style="color: #006699;">2、输入的实际参数与形式参数的属性是否匹配； </span></p>
<p><span style="color: #006699;">3、输入的实际参数与形式参数的量纲是否一致； </span></p>
<p><span style="color: #006699;">4、调用其他模块时所给实际参数的个数是否与被调模块的形参个数相同； </span></p>
<p><span style="color: #006699;">5、调用其他模块时所给实际参数的属性是否与被调模块的形参属性匹配； </span></p>
<p><span style="color: #006699;">6、调用其他模块时所给实际参数的量纲是否与被调模块的形参量纲一致； </span></p>
<p><span style="color: #006699;">7、调用预定义函数时所用参数的个数、属性和次序是否正确； </span></p>
<p><span style="color: #006699;">8、是否存在与当前入口点无关的参数引用； </span></p>
<p><span style="color: #006699;">9、是否修改了只读型参数； </span></p>
<p><span style="color: #006699;">10、对全程变量的定义各模块是否一致； </span></p>
<p><span style="color: #006699;">11、是否把某些约束作为参数传递。</span></p>
<p><br style="line-height: normal !important;" /> 如果模块功能包括外部输入输出，还应该考虑下列因素： <br style="line-height: normal !important;" /><br style="line-height: normal !important;" /><span style="color: #006699;">1、文件属性是否正确； </span></p>
<p><span style="color: #006699;">2、OPEN/CLOSE语句是否正确； </span></p>
<p><span style="color: #006699;">3、格式说明与输入输出语句是否匹配； </span></p>
<p><span style="color: #006699;">4、缓冲区大小与记录长度是否匹配； </span></p>
<p><span style="color: #006699;">5、文件使用前是否已经打开； </span></p>
<p><span style="color: #006699;">6、是否处理了文件尾； </span></p>
<p><span style="color: #006699;">7、是否处理了输入/输出错误； </span></p>
<p><span style="color: #006699;">8、输出信息中是否有文字性错误。 </span></p>
<p><span style="color: #006699;"><br />
</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><strong>二、</strong><strong>局部数据结构测试</strong></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><strong> </strong>检查局部数据结构是为了保证临时存储在模块内的数据在程序执行过程中完整、正确，局部功能是整个功能运行的基础。重点是一些函数是否正确执行，内部是否运行正确。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">局部数据结构往往是错误的根源，应仔细设计测试用例，力求发现下面几类错误： <br style="line-height: normal !important;" /><span style="color: #006699;">1、不合适或不相容的类型说明；  <br style="line-height: normal !important;" />2、变量无初值；  <br style="line-height: normal !important;" />3、变量初始化或省缺值有错；  <br style="line-height: normal !important;" />4、不正确的变量名（拼错或不正确地截断）；  <br style="line-height: normal !important;" />5、出现上溢、下溢和地址异常。</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><br style="line-height: normal !important;" /><span style="line-height: normal !important;"><strong>三、</strong></span><strong>边界条件测试</strong></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><span style="line-height: normal !important;"> </span>边界条件测试是单元测试中最重要的一项任务。众所周知，软件经常在边界上失效，采用边界值分析技术，针对边界值及其左、右设计测试用例，很有可能发现新的错误。边界条件测试是一项基础测试，也是后面<span style="line-height: normal !important;"><a style="color: #000000; text-decoration: none; line-height: normal !important;" href="http://www.ltesting.net/html/70/category-catid-470.html" target="_blank">系统测试</a></span>中的<span style="line-height: normal !important;"><a style="color: #000000; text-decoration: none; line-height: normal !important;" href="http://www.ltesting.net/html/93/category-catid-93.html" target="_blank">功能测试</a></span>的重点，边界测试执行的较好，可以大大提高程序健壮性。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><strong>四、</strong><span style="line-height: normal !important;"><strong>模块中所有独立路径测试</strong></span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><span style="line-height: normal !important;"> </span>在模块中应对每一条独立执行路径进行测试，单元测试的基本任务是保证模块中每条语句至少执行一次。测试目的主要是为了发现因错误计算、不正确的比较和不适当的控制流造成的错误。具体做法就是<span style="line-height: normal !important;"><a style="color: #000000; text-decoration: none; line-height: normal !important;" href="http://www.ltesting.net/html/78/category-catid-478.html" target="_blank">程序员</a></span>逐条调试语句。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">常见的错误包括： <br style="line-height: normal !important;" /><span style="color: #006699;">1、误解或用错了算符优先级；  <br style="line-height: normal !important;" />2、混合类型运算；  <br style="line-height: normal !important;" />3、变量初值错；  <br style="line-height: normal !important;" />4、精度不够；  <br style="line-height: normal !important;" />5、表达式符号错。</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><br style="line-height: normal !important;" /> 比较判断与控制流常常紧密相关，测试时注意下列错误：  <br style="line-height: normal !important;" /><span style="color: #006699;">1、不同数据类型的对象之间进行比较；  <br style="line-height: normal !important;" />2、错误地使用逻辑运算符或优先级；  <br style="line-height: normal !important;" />3、因计算机表示的局限性，期望理论上相等而实际上不相等的两个量相等；  <br style="line-height: normal !important;" />4、比较运算或变量出错；  <br style="line-height: normal !important;" />5、循环终止条件或不可能出现；  <br style="line-height: normal !important;" />6、迭代发散时不能退出；  <br style="line-height: normal !important;" />7、错误地修改了循环变量。</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><span style="color: #006699;"><br />
</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;"><strong>五、模块的各条错误处理通路测试</strong></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">程序在遇到异常情况时不应该退出，好的程序应能预见各种出错条件，并预设各种出错处理通路。如果用户不按照正常操作，程序就退出或者停止工作，实际上也是一种<span style="line-height: normal !important;"><a style="color: #000000; text-decoration: none; line-height: normal !important;" href="http://www.ltesting.net/html/98/category-catid-98.html" target="_blank">缺陷</a></span>，因此单元测试要测试各种错误处理路径。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">一般这种测试着重检查下列问题： <br style="line-height: normal !important;" /><span style="color: #006699;">1、输出的出错信息难以理解；  <br style="line-height: normal !important;" />2、记录的错误与实际遇到的错误不相符；  <br style="line-height: normal !important;" />3、在程序自定义的出错处理段运行之前，系统已介入；  <br style="line-height: normal !important;" />4、异常处理不当；  <br style="line-height: normal !important;" />5、错误陈述中未能提供足够的定位出错信息。</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; line-height: 28px; padding: 0px; border: 0px initial initial;">
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/02/%e7%90%86%e8%a7%a3%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95%e4%b8%bb%e8%a6%81%e5%86%85%e5%ae%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>学习web测试要点</title>
		<link>http://www.jgcao.com/index.php/2010/02/%e5%ad%a6%e4%b9%a0web%e6%b5%8b%e8%af%95%e8%a6%81%e7%82%b9/</link>
		<comments>http://www.jgcao.com/index.php/2010/02/%e5%ad%a6%e4%b9%a0web%e6%b5%8b%e8%af%95%e8%a6%81%e7%82%b9/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 03:20:59 +0000</pubDate>
		<dc:creator>jgcao</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.jgcao.com/?p=804</guid>
		<description><![CDATA[一、功能测试 1、链接测试 （1）、测试所有链接是否按指示的那样确实链接到了该链接的页面； （2）、测试所链接的页面是否存在； （3）、保证Web应用系统上没有孤立的页面(所谓孤立页面是指没有链接指向该页面，只有知道正确的URL地址才能访问)。 2、表单测试 （1）、注册、登陆、信息提交等，必须测试提交操作的完整性，以校验提交给服务器的信息的正确性； （2）、用户填写的出生日期与职业是否恰当，填写的所属省份与所在城市是否匹配等； （3）、检验默认值的正确性； （4）、如表单只能接受指定的某些值，测试时跳过这些字符，看系统是否会报错。 3、Cookies测试(session测试同) （1）、Cookies是否起作用； （2）、Cookies是否按预定的时间进行保存； （3）、刷新对Cookies有什么影响。 4、设计语言测试 （1）、使用哪种版本的HTML； （2）、验证脚本语言Javascrīpt。 5、数据库测试 （1）、数据一致性错误：主要是由于用户提交的表单信息不正确而造成的； （2）、输出错误：主要是由于网络速度或程序设计问题等引起的。 二、性能测试 1、连接速度测试 （1）、Web系统响应时间； （2）、超时的限制。 2、负载测试 （1）、某个时刻同时访问Web系统的用户数量； （2）、也可以是在线数据处理的数量。 3、压力测试 （1）、压力测试是测试系统的限制和故障恢复能力，也就是测试Web应用系统会不会崩溃，在什么情况下会崩溃。黑客常常提供错误的数据负载，直到Web应用系统崩溃，接着当系统重新启动时获得存取权。 （2）、压力测试的区域包括表单、登陆和其他信息传输页面等。 三、可用性测试 1、导航测试 （1）、导航是否直观 （2）、Web系统的主要部分是否可通过主页存取 （3）、系统是否需要站点地图、搜索引擎或其他的导航帮助 （4）、Web应用系统的页面结构、导航、菜单、连接的风格是否一致  （5）、Web应用系统导航帮助要尽可能地准确。Web应用系统的层次一旦决定，就要着手测试用户导航功能。 2、图形测试一个Web应用系统的图形可以包括图片、动画、边框、颜色、字体、背景、按钮等。图形测试的内容有： （1）、要确保图形有明确的用途，图片或动画不要胡乱地堆在一起，以免浪费传输时间； （2）、Web应用系统的图片尺寸要尽量地小，并且要能清楚地说明某件事情，一般都链接到某个具体的页面； （3）、验证所有页面字体的风格是否一致； （4）、背景颜色应该与字体颜色和前景颜色相搭配； （5）、图片的大小和质量也是一个很重要的因素，一般采用JPG或GIF压缩。 3、内容测试 检验Web应用系统提供信息的正确性、准确性和相关性。 信息的正确性是指信息是可靠的还是误传的 。 4、整体界面测试 整体界面是指整个Web应用系统的页面结构设计，是给用户的一个整体感。例如：当用户浏览Web应用系统时是否感到舒适，是否凭直觉就知道要找的信息在什么地方？整个Web应用系统的设计风格是否一致？当然，对界面的整体测试并不能单靠个人直觉来评定；每个人的审美观、专业角度、系统面向的行业及用户、甚至性别与年龄等等，都是可能导致对界面作出不同评价的因素。所以要明白在对整体界面的测试过程中，其实是一个对最终用户进行调查的过程。一般Web应用系统采取在主页上做一个调查问卷的形式，来得到最终用户的反馈信息。 四、兼容性测试 1、平台测试 在Web系统发布之前，需要在各种操作系统下对Web系统进行兼容性测试。 2、浏览器测试 （1）、浏览器是Web客户端最核心的构件，来自不同厂商的浏览器对Java，、Javascrīpt、ActiveX、 plug-ins或不同的HTML规格有不同的支持。 [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: 黑体;"><strong>一、功能测试</strong></span></p>
<p><strong>1、</strong><strong>链接测试 </strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、测试所有链接是否按指示的那样确实链接到了该链接的页面；<br style="word-break: break-all; line-height: normal !important;" /> （2）、测试所链接的页面是否存在；<br style="word-break: break-all; line-height: normal !important;" /> （3）、保证Web应用系统上没有孤立的页面(所谓孤立页面是指没有链接指向该页面，只有知道正确的URL地址才能访问)。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong> 2、表单测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、注册、登陆、信息提交等，必须测试提交操作的完整性，以校验提交给服务器的信息的正确性；<br style="word-break: break-all; line-height: normal !important;" /> （2）、用户填写的出生日期与职业是否恰当，填写的所属省份与所在城市是否匹配等；<br style="word-break: break-all; line-height: normal !important;" /> （3）、检验默认值的正确性；<br style="word-break: break-all; line-height: normal !important;" /> （4）、如表单只能接受指定的某些值，测试时跳过这些字符，看系统是否会报错。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>3、Cookies测试(session测试同)</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、Cookies是否起作用；<br style="word-break: break-all; line-height: normal !important;" /> （2）、Cookies是否按预定的时间进行保存；<br style="word-break: break-all; line-height: normal !important;" /> （3）、刷新对Cookies有什么影响。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>4、设计语言测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、使用哪种版本的HTML；<br style="word-break: break-all; line-height: normal !important;" /> （2）、验证脚本语言Javascrīpt。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>5、</strong><strong>数据库</strong><strong>测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、数据一致性错误：主要是由于用户提交的表单信息不正确而造成的；<br style="word-break: break-all; line-height: normal !important;" /> （2）、输出错误：主要是由于网络速度或程序设计问题等引起的。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>二、</strong><strong>性能测试</strong></p>
<p><strong><a style="word-break: break-all; text-decoration: underline; color: #000000; line-height: normal !important;" href="http://www.51testing.com/?uid-144635-action-viewspace-itemid-170208" target="_self"><span style="word-break: break-all; line-height: normal !important; text-decoration: underline;"><strong></strong></span></a></strong><br style="word-break: break-all; line-height: normal !important;" /><strong>1、连接速度测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、Web系统响应时间；<br style="word-break: break-all; line-height: normal !important;" /> （2）、超时的限制。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>2、负载测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、某个时刻同时访问Web系统的用户数量；<br style="word-break: break-all; line-height: normal !important;" /> （2）、也可以是在线数据处理的数量。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>3、</strong><strong>压力测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、压力测试是测试系统的限制和故障恢复能力，也就是测试Web应用系统会不会崩溃，在什么情况下会崩溃。黑客常常提供错误的数据负载，直到Web应用系统崩溃，接着当系统重新启动时获得存取权。<br style="word-break: break-all; line-height: normal !important;" /> （2）、压力测试的区域包括表单、登陆和其他信息传输页面等。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>三、可用性测试</strong></p>
<p><strong><br style="word-break: break-all; line-height: normal !important;" />1、导航测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、导航是否直观<br style="word-break: break-all; line-height: normal !important;" /> （2）、Web系统的主要部分是否可通过主页存取<br style="word-break: break-all; line-height: normal !important;" /> （3）、系统是否需要站点地图、搜索引擎或其他的导航帮助<br style="word-break: break-all; line-height: normal !important;" /> （4）、Web应用系统的页面结构、导航、菜单、连接的风格是否一致 <br style="word-break: break-all; line-height: normal !important;" /> （5）、Web应用系统导航帮助要尽可能地准确。Web应用系统的层次一旦决定，就要着手测试用户导航功能。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>2、图形测试</strong><br style="word-break: break-all; line-height: normal !important;" />一个Web应用系统的图形可以包括图片、动画、边框、颜色、字体、背景、按钮等。图形测试的内容有：<br style="word-break: break-all; line-height: normal !important;" /> （1）、要确保图形有明确的用途，图片或动画不要胡乱地堆在一起，以免浪费传输时间；<br style="word-break: break-all; line-height: normal !important;" /> （2）、Web应用系统的图片尺寸要尽量地小，并且要能清楚地说明某件事情，一般都链接到某个具体的页面；<br style="word-break: break-all; line-height: normal !important;" /> （3）、验证所有页面字体的风格是否一致；<br style="word-break: break-all; line-height: normal !important;" /> （4）、背景颜色应该与字体颜色和前景颜色相搭配；<br style="word-break: break-all; line-height: normal !important;" /> （5）、图片的大小和质量也是一个很重要的因素，一般采用JPG或GIF压缩。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>3、内容测试</strong><br style="word-break: break-all; line-height: normal !important;" /> 检验Web应用系统提供信息的正确性、准确性和相关性。<br style="word-break: break-all; line-height: normal !important;" /> 信息的正确性是指信息是可靠的还是误传的 。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>4、整体界面测试</strong><br style="word-break: break-all; line-height: normal !important;" /> 整体界面是指整个Web应用系统的页面结构设计，是给用户的一个整体感。例如：当用户浏览Web应用系统时是否感到舒适，是否凭直觉就知道要找的信息在什么地方？整个Web应用系统的设计风格是否一致？当然，对界面的整体测试并不能单靠个人直觉来评定；每个人的审美观、专业角度、系统面向的行业及用户、甚至性别与年龄等等，都是可能导致对界面作出不同评价的因素。所以要明白在对整体界面的测试过程中，其实是一个对最终用户进行调查的过程。一般Web应用系统采取在主页上做一个调查问卷的形式，来得到最终用户的反馈信息。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>四、兼容性测试</strong></p>
<p><strong></strong><br style="word-break: break-all; line-height: normal !important;" /><strong>1、平台测试</strong><br style="word-break: break-all; line-height: normal !important;" /> 在Web系统发布之前，需要在各种操作系统下对Web系统进行兼容性测试。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>2、浏览器测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、浏览器是Web客户端最核心的构件，来自不同厂商的浏览器对Java，、Javascrīpt、ActiveX、 plug-ins或不同的HTML规格有不同的支持。<br style="word-break: break-all; line-height: normal !important;" /> （2）、测试浏览器兼容性的一个方法是创建一个兼容性矩阵。在这个矩阵中，测试不同厂商、不同版本的浏览器对某些构件和设置的适应性。</p>
<p><br style="word-break: break-all; line-height: normal !important;" /><strong>五、安全性测试</strong><br style="word-break: break-all; line-height: normal !important;" /> （1）、现在的Web应用系统基本采用先注册，后登陆的方式。因此，必须测试有效和无效的用户名和密码，要注意到是否大小写敏感，可以试多少次的限制，是否可以不登陆而直接浏览某个页面等；<br style="word-break: break-all; line-height: normal !important;" /> （2）、Web应用系统是否有超时的限制，用户登陆后在一定时间内（例如15分钟）没有点击任何页面，是否需要重新登陆才能正常使用；<br style="word-break: break-all; line-height: normal !important;" /> （3）、为了保证Web应用系统的安全性，需要测试相关信息是否写进了日志文件、是否可追踪；<br style="word-break: break-all; line-height: normal !important;" /> （4）、当使用了安全套接字时，还要测试加密是否正确，检查信息的完整性；<br style="word-break: break-all; line-height: normal !important;" /> （5）、服务器端的脚本常常构成安全漏洞，这些漏洞又常常被黑客利用。所以，还要测试没有经过授权，就不能在服务器端放置和编辑脚本的问题。<br style="word-break: break-all; line-height: normal !important;" /> （6）、通过模拟攻击的形式拷贝Web应用程序的某个功能点的url地址，然后打开新的页面输入该url地址看其是否能跨过系统的登录模块直接进入该功能点。<br style="word-break: break-all; line-height: normal !important;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jgcao.com/index.php/2010/02/%e5%ad%a6%e4%b9%a0web%e6%b5%8b%e8%af%95%e8%a6%81%e7%82%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

