Linux °æ (¾«»ªÇø)
·¢ÐÅÈË: clx (³þÁôÏã), ÐÅÇø: Unix
±ê Ìâ: °¢ÅÁÆæ HTTP ·þÎñÆ÷²Î¿¼ÊÖ²á
·¢ÐÅÕ¾: ×Ï ¶¡ Ïã (Sat Jun 27 10:36:04 1998), תÐÅ
°¢ÅÁÆæ HTTP ·þÎñÆ÷²Î¿¼ÊÖ²á
ÔʼÎļþ£ºmanual.ps.gz
ÎļþÐðÊö£º°¢ÅÁÆæ HTTP ·þÎñÆ÷²Î¿¼ÊÖ²á
Îļþ±àºÅ£ºLRG.LDTP.GUIDE.002
·ÒëÈÕÆÚ£º1996/09/01
·Òëά»¤£ºasdchen@ms1.hinet.net
¼òÌåÖÐÎÄ°æά»¤:dfbb, fangh@bepc3.ihep.ac.cn
APACHE
An HTTP Server
Reference Manual
@ David Robinson and the Apache Group, 1995
http://www.apache.org/
±£ÁôËùÓÐȨÀû¡£Õâ¸ö²úÆ·»òÎļþÊÜ°æȨ±£»¤²¢ÇÒµÃÔÚÏÞÖÆÆäÓÃ;£¬¸´ÖÆ
£¬É¢²¥ÒÔ¼°±à¼µÄÊÚȨÏÂÉ¢²¥¡£Ï¸½ÚÇë²ÎÔÄ°¢ÅÁÆæÊÚȨÊé¡£
°æȨËùÓÐÕß²»¶ÔÕâ·ÝÊÖ²áµÄÄÚÈÝ×÷Èκα£Ö¤¼°½¨Òé¶øÇÒÌرðÉùÃ÷²»±£Ö¤
·ûºÏÈκÎÉÌҵĿµÄ¡£
°æȨËùÓÐÕß±£ÁôÐÞ¶©Õâ·ÝÊÖ²áµÄȨÀûÇÒÆäÄÚÈݵÃÒÀʱ±ä¸ü¶ø²»±Ø֪ͨÈÎ
ºÎÈËÕâЩÐÞ¶©Óë±ä¸ü¡£
All rights reserved. This product or documentation protected by
copyright and is distributed under licences restricting its
use,copying,distribution and decompilation. See the Apache licence
for details.
The copyright owner gives no warranties and makes no representations
about the contents of this manual and specifically disclaims
warranties of merchantability of fitness for any purpose.
The Copyright owner reserves the right to revise this manual and
make changes from time to time in its contents without notifying any
person of such revision or changes.
TRADEMARKS
Unix is a registered trademark of UNIX System Laboratories, Inc.
Sun and SunOs are trademarks of Sun Microsystems, Inc. Netscape is a
trademark of Netscape Communications Corporation. All other product
names mentioned herein are trademarks of their respective owners.
Ŀ¼(Contents) £¨ÂÔ£©
Ðò(Preface)
Õâ·ÝÊÖ²áÊÇ 1.0 °æ°¢ÅÁÆæ·þÎñÆ÷(Apache HTTP server)µÄÎļþ¡£Õâ¸ö
·þÎñÆ÷ÊÇ°¢ÅÁÆæ¼Æ»®µÄ²úÆ·£¬´Ë¼Æ»®ÊÔͼ»ØӦijЩ¶Ô»ý¼«·¢Õ¹Ò»Ì׿ÉÒÔ
Ãâ·ÑÈ¡µÃÖ® HTTP ·þÎñÆ÷µÄ¹ØÐÄ¡£Õâ¸ö¼Æ»®µÄÄ¿±êÊÇÌṩһ¸ö°²È«µÄ£¬
ÓÐЧÂʵĶøÇÒ¿ÉÒÔÀ©³ä¹¦ÄܵķþÎñÆ÷£¬´Ë·þÎñÆ÷Ìṩ HTTP ·þÎñÇÒ·ûºÏ
Ä¿Ç°µÄ HTTP ±ê×¼¡£
ÕâÌ×°¢ÅÁÆæ httpd ·þÎñÆ÷µÄÉè¼Æ²»µ«Óë NCSA httpd 1.3 ÏàÈÝ£¬²¢ÇÒ
Ìṩ³£³£ÓÐÈËÒªÇóµÄÌØÉ«£¬ÏñÊÇ
¡£×÷ΪÉí·ÖÑéÈÏÖ®ÓÃµÄ DBM ×ÊÁÏ¿â
¡£×Ô¶¨µÄ(customised)´íÎóÓëÎÊÌâ»ØÓ¦·½Ê½
¡£¶àÖØµÄ directoryindex Ö¸Áî
¡£²»ÏÞ´ÎÊýµÄ Alias ÒÔ¼° Redirect Ö¸Áî
¡£ÒÔÄÚÈÝΪ»ù´¡µÄ(Content-based) ÎļþÐÉÌ(negotiation)
¡£ÐéÄâ·þÎñÆ÷
°¢ÅÁÆæÊÚȨÊé
Copyright 1995 The Apache Group. All rights reserved.
¼ÙÈô·ûºÏÏÂÁÐÌõ¼þ£¬ÎÞÂÛÊÇ·ñ¾¹ýÐ޸ģ¬ÒÔÔʼ³ÌÐò¼°Ö´ÐгÌÐòµÄÐÎʽ
É¢²¥ÓëʹÓö¼ÊÇÐí¿ÉµÄ:
1. É¢²¥Ôʼ³ÌÐòÂë±ØÐë±£ÁôÉÏÊöµÄ°æȨ¸æʾ£¬Õâ·ÝÌõ¼þÁбíÒÔ¼°ÏÂÁÐ
ÉùÃ÷¡£
2. ÒÔÖ´ÐгÌÐòÂëµÄÐÎʽɢ²¥±ØÐëÔÚË渽ɢ²¥µÄÎļþÒÔ¼°£¯»òÊÇ×ÊѶÖÐ
ÖØÏÖÉÏÊöµÄ°æȨ¸æʾ£¬Õâ·ÝÌõ¼þÁбíÒÔ¼°ÏÂÁÐÉùÃ÷¡£
3. ËùÓÐÌá¼°»òʹÓÃÕâÌ×ÈíÌåÌØÉ«µÄ¹ã¸æ¶¼±ØÐëÏÔʾÏÂÁÐѶϢ:
`This product includes software developed by the Apache Group
for use in the Apache HTTP server project (http://www.apache.org/).'
4. `Apache Server' ÒÔ¼° `Apache Group' ÕâЩÃû³ÆûÓÐË渽ǰÊöµÄ
µÄÐí¿É²»µÃÓÃÀ´ÎªÕâÌ×ÈíÌåµÄÑÜÉú²úÆ·±³Êé»ò¹ÄÀø²ÉÓá£
5. ÒÔÈκÎÐÎʽɢ²¥¶¼±ØÐë±£ÁôÏÂÁÐѶϢ:
`This product includes software developed by the Apache Group
for use in the Apache HTTP server project (http://www.apache.org/).'
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condictions
are met:
1. Redistribution of source code must retain the above copyright
notice, this list of condictions and the following disclaimer.
2. Redistribution in binary form must reproduce the above copyright
notice, this list of condictions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledge: `This product
includes software developed by the Apache Group for use in the
Apache HTTP server project (http://www.apache.org/).'
4. The names `Apache Server' and `Apache Group' must not be used to
endorse or prompt products derived from this software without
prior written permission.
5. Redistribution of any form whatsoever must retain the following
acknowledge: `This product includes software developed by the
Apache Group for use in the Apache HTTP server project
(http://www.apache.org/).'
THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARITICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR ITS
CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDETAL, SPECIAL,
EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHERHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHER WISE)ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals on behalf of the Apache Group and was originally
based on public domain software written at the National Center
for Supercomputing Applications, University of Illinois, Urbana-
Champaign. For more information on the apache Group and the Apache
HTTP server project, please see http://www.apache.org/.
µÚÒ»ÕÂ
±àÒëÒÔ¼°°²×°°¢ÅÁÆæ
1.1 ÏÂÔØ°¢ÅÁÆæ
×îÐµİ¢ÅÁÆæ×ÊѶ¿ÉÒÔÔÚ°¢ÅÁÆæÍøÕ¾ http://www.apache.org/ ÕÒµ½¡£
´Ë´¦»áÁгöÄ¿Ç°·¢Ðеİ汾£¬ÈκθüÐµĹ«¿ª²âÊ԰棬ͬʱ»¹ÓÐÓ³ÉäµÄ
(mirror)ÍøÕ¾ÓëÄäÃûÎļþ´«Êä(ftp) վ֮ϸ½Ú¡£
1.2 ±àÒë°¢ÅÁÆæ
ÕâÒ»°æµÄ°¢ÅÁÆæÖ§Ô®ËùνµÄ¡®Ñ¡ÓÃÐÔÄ£×顯¡£È»¶ø£¬ÎªÁËʹÕâЩģ×éÄÜ
ÓÐЧÂÊ£¬´Ë·þÎñÆ÷±ØÐëÖªµÀÄÄЩģ×éÒª±àÒë½øÈ¥£»ÕâÐèÒª²úÉúÒ»µã¶Ì¶Ì
µÄ³ÌÐòÂë(`modules.c') µ¥´¿µØÁгöËüÃÇ¡£
Èç¹ûÄãÂúÒâÎÒÃǵıê׼ģ×鼯£¬¶øÇÒ´òËã¼ÌÐøÈÃËü±£³ÖÕâÑù£¬ÄÇ÷áÄã¿É
ÒÔÖ±½Ó±à¼ÎÒÃÇÌṩµÄ Makefile ²¢ÇÒÈçͬÄãÒÔÇ°×÷¹ýµÄÒ»Ñù±àÒëËü¡£
Èç¹ûÄãÏëҪʹÓÃÑ¡ÓÃÐÔÄ£×飬ÄÇ÷áÎÞÂÛÈçºÎ£¬Ä㶼µÃÖ´ÐÐÅäÖÃÖ¸Áî¸å¡£
ÕâÑù×ö:
1. ±à¼ `Configuration' Õâ¸öÎļþ¡£ÕâÀïÃæ°üº¬Ã¿Ò»ÖÖ»úÆ÷
µÄ Makefile É趨£¬¶øÇÒÔÚÕâµ×Ï»¹Óиö¶îÍâµÄ½ÚÇøÁгöÒª
±àÒë½øÈ¥µÄÄ£×飬ÒÔ¼°°üº¬ÕâЩģ×éµÄÎļþÃû³Æ£¬Ä㽫µÃ:
(a) Ñ¡ÔñÊʺÏÄã»úÆ÷µÄÒ»ÖÖ±àÒëÆ÷ÒÔ¼°±àÒëÑ¡Ïî¡£
(b) ÏûµôÏà¶Ôì¶ÄãÏë°üº¬½øÈ¥µÄÄ£×éÉÏÃæµÄ×¢½â£¨Îļþµ×
¶ËÁгöÄ£×éµÄÄÇЩÐУ©»òÕß¼ÓÉ϶ÔÓ¦Äã×Ô¼ºËù׫д֮
×ÔÖÆ(custom)Ä£×éµÄһЩÐÂÐС£×¢Ò⣬Èç¹ûÄãÏëÒªÓÐ
DBM ÑéÈÏ(auth)µÄ»°±ØÐëÃ÷È·µØÅäÖýøÈ¥£»Ö»ÒªÏûµô
¶ÔÓ¦µÄÐÐÉÏÃæµÄ×¢½â¼´¿É¡£
2. Ö´ÐÐ `Configure' Õâ¸öÖ¸Áîshell;
% Configure
Using `Configuration' as config file
%
Õâ»á²úÉúаæµÄ Makefile ÒÔ¼° modules.c Îļþ¡£Èç¹ûÄã
ÏëҪά»¤¶à¸öÅäÖã¬ÄÇ÷áÄã¿ÉÒÔÕâÑù£¬ÀýÈç
% Configure -file Configuration.ai
Using alternate config file Configuration.ai
%
3. ¼üÈë `make'
ÎÒÃǷŽø°¢ÅÁÆæ·¢ÐÐÌ×¼þÀïµÄÄ£×éÊÇÎÒÃDzâÊÔ¹ý¶øÇÒÓÐÐí¶à
°¢ÅÁÆ淢չȺ³ÉԱʹÓõÄÄ£×é¡£ÕâЩ³ÉÔ±»òÐÁ¦ÍÅÌå(third
parties)ÅäºÏÌØÊâÐèÒª»ò¹¦Äܶø¹±Ï×µÄһЩ¶îÍâÄ£×é¿ÉÒÔÔÚ
<URL:http://www.apache.org/dist/contrib/modules/> Àï
ÕÒµ½¡£ÔÚ¸ÃÍøÒ³ÉÏÓÐÈçºÎÁ¬½áÕâЩģ×éµ½°¢ÅÁÆæºËÐijÌÐòÂë
ÀïÈ¥µÄ˵Ã÷¡£
1.3 °²×°°¢ÅÁÆæ
±àÒëÖ®áᣬÄ㽫»áÔÚ src/ Ŀ¼Àï»ñµÃÒ»·Ý³ÆΪ `httpd' µÄ¿ÉÖ´ÐÐÎļþ¡£
°¢ÅÁÆæµÄ¿ÉÖ´ÐÐÎļþ·¢ÐÐÌ×¼þ»áÌṩÕâ¸öÎļþ¡£
ÏÂÒ»¸ö²½ÖèÊÇΪ·þÎñÆ÷±à¼ÅäÖõµ¡£ÄãÓ¦¸Ã»áÔÚ³ÆΪ `conf' µÄĿ¼Àï
·¢ÏÖÈý¸öÅäÖõµµÄ·¢Ðа汾: srm.conf-dist, access.conf-dist ÒÔ¼°
httpd.conf-dist ¡£°ÑËüÃǸ´ÖƳÉËùÐèµÄ srm.conf, access.conf ¼°
httpd.conf Îļþ¡£
Ê×Ïȱ༠httpd.conf ¡£ÕâÉ趨´Ë·þÎñÆ÷Ò»°ãµÄÊôÐÔ£»¶Ë¿ÚºÅ£¬Ö´ÐÐÕßµÄ
Éí·ÖµÈµÈ¡£½ÓÏÂÀ´±à¼ srm.conf Îļþ£»ÕâÉ趨ÎļþÊ÷µÄ¸ùĿ¼£¬Ö¸¶¨ÏñÊÇ
·þÎñ¶ËÆÊÎöµÄ HTML »òÄÚ²¿µÄÓ°ÏñµØͼ(imagemap)ÆÊÎöµÈµÈ¹¦ÄÜ¡£×îáá
±à¼ access.conf Îļþ£¬ÖÁÉÙ×÷Щ´æÈ¡(access)µÄ»ù±¾É趨¡£
×îáᣬµ÷ÓÃhttpd ³ÌÐò£¬Ê¹Óà -f ²ÎÊýÅäºÏ httpd.conf ËùÔÚµÄÍêÕû
·¾¶¡£ÏñÊÇ£¬×îÆÕ±éµÄÀý×Ó:
/usr/local/etc/apache/src/httpd -f
/usr/local/etc/apache/conf/httpd.conf
ÏÖÔÚ·þÎñÆ÷Ó¦¸ÃÒѾ¿ªÊ¼Ö´ÐС£
ÒÀÕÕÔ¤Éè srm.conf ÒÔ¼° access.conf ÕâЩÎļþÊǽåÓÉÃû³Æ¶¨Î»µÄ£»
Òª½åÓÉÆäËüµÄÃû³ÆÀ´Ö¸¶¨µ÷ÓÃËüÃǵĻ°£¬¿ÉÒÔÔÚ httpd.conf ÀïÃæʹÓÃ
AccessConfig ÒÔ¼° ResourceConfig Ö¸Áî¡£
µÚ¶þÕÂ
Æô¶¯°¢ÅÁÆæ
2.1 Æô¶¯°¢ÅÁÆæ
httpd ÕâÖ§³ÌÐò¿ÉÒÔ½åÓÉÍø¼ÊÍø··þÎñ³ÌÐò inetd ÔÚÿһ´ÎÓÐÁ¬ÏßÒª
½øÈë HTTP ·þÎñµÄʱºòÆô¶¯£¬»òÕßÁíÒ»ÖÖ·½Ê½£¬ËüÒ²¿ÉÒÔ×÷Ϊ·þÎñ³ÌÐò
(daemon)³ÖÐøµØÖ´ÐУ¬´¦ÀíÇëÇó¡£ÎÞÂÛÑ¡ÔñÄÄÒ»ÖÖ·½Ê½£¬¶¼±ØÐëÉ趨Õâ
¸ö ServerType Ö¸Áî¸æËß·þÎñÆ÷ËüÒªÈçºÎÖ´ÐС£
2.2 ÃüÁîÁÐÑ¡Ïî
ÏÂÁÐÑ¡Ïî¿ÉÒÔÓÃÔÚ httpd µÄÃüÁîÁÐÉÏ:
-d serverroot
°Ñ ServerRoot Õâ¸ö²ÎÊýµÄÆðʼֵÉ趨Ϊ serverroot ¡£Õâ¿ÉÒÔ
½åÓÉÔÚÅäÖÃÎļþÀïÃæµÄ ServerRoot ÃüÁîÀ´¼ÓÒԸı䡣´ËÔ¤ÉèΪ
/usr/local/etc/httpd ¡£
-f config
Æô¶¯Ê±Ö´ÐÐÔÚ config ÎļþÀïÃæµÄÖ¸Áî¡£Èç¹û config ûÓÐÒÔ /
×÷Ϊ¿ªÊ¼µÄ»°£¬ÄÇ÷áËü»á±»µ±×÷Ïà¶Ôì¶ ServerRoot µÄ·¾¶¡£´Ë
Ô¤ÉèÖµÊÇ conf/httpd.conf ¡£
-X
ÒÔµ¥Ò»³ÌÐò(single-process)ģʽִÐУ¬Ö»ÓÃÔÚÄÚ²¿³ý´í£»·þÎñ
³ÌÐò²»»áÍÑÀëÖÕ¶Ë×÷Òµ»òÊDzúÉúÈκÎ×Ó³ÌÐò¡£²»ÒªÊ¹ÓÃÕâ¸öģʽ
À´ÌṩÕý³£µÄÍøÒ³·þÎñ¡£
-v
ÁÐÓ¡ httpd µÄ°æ±¾£¬È»áá½áÊø¡£
-?
ÁÐÓ¡ httpd Ñ¡ÏîµÄÒ»·ÝÁÐ±í£¬È»áá½áÊø¡£
2.3 ÅäÖõµ
´Ë·þÎñÆ÷½«»á¶ÁÈ¡Èý¸öÅäÖÃÖ¸ÁîÎļþ¡£ÈκÎÖ¸Á¿ÉÒÔ³öÏÖÔÚÕâЩÎļþ
ÈκÎÒ»¸öÀïÃæ¡£ÕâЩÎļþµÄÃû³ÆÊÇÏà¶Ô춷þÎñÆ÷µÄ¸ùĿ¼(server root) £»
ÕâÊǸùÊǽåÓÉ ServerRoot Ö¸Á»òÊÇ -d Õâ¸öÃüÁîÁÐÆì±êËùÖ¸¶¨µÄ¡£
ÒÀ¹ßÀýÕâЩÎļþÊÇ:
conf/httpd.conf
°üº¬¿ØÖÆ·þÎñ³ÌÐòÔË×÷µÄÖ¸Áî¡£ÎļþÃû³Æ¿ÉÒÔÅäºÏ -f ÃüÁîÁÐÆì
Æì±ê¼ÓÒԸı䡣
conf/srm.conf
°üº¬¿ØÖÆ·þÎñÆ÷Ìṩ¸ø¿Í»§¶ËÖ®Îļþ¹æ¸ñµÄÖ¸Áî¡£ÎļþÃû³Æ¿ÉÒÔ
ÅäºÏ ResourceConfig Ö¸Áî¼ÓÒԸı䡣
conf/access.conf
°üº¬¿ØÖÆÎļþÖ®´æÈ¡µÄÖ¸Áî¡£ÎļþÃû³Æ¿ÉÒÔÅäºÏ AccessConfig
Ö¸Áî¼ÓÒԸı䡣
ÎÞÂÛÈçºÎ£¬ÕâЩ¹ßÀý²¢²»ÐèÒªÍêÈ«×ñ·î¡£
´Ë·þÎñÆ÷Ò²»á¶ÁÈ¡Ò»¸ö°üº¬ MIME ÎļþÐÍ̬µÄÎļþ£»Õâ¸öÎļþÃû³Æ½åÓÉ
TypesConfig Ö¸ÁîÉ趨£¬¶øÇÒÓиö conf/mini.types ×÷ΪԤÉè¡£
2.4 ¼Ç¼µµ
2.4.1 pid µµ
·þÎñ³ÌÐòÆô¶¯Ê±£¬Ëü°Ñ¸¸³ÌÐò httpd µÄ³ÌÐòÂë(process id)´æÍùÕâ¸ö
log/httpd.pid Îļþ¡£Õâ¸öÎļþÃû³Æ¿ÉÒÔÅäºÏ PidFile Ö¸Áî¼ÓÒԸıä
¡£Õâ¸ö³ÌÐòÂëÓɹÜÀíÕßÓÃÀ´ÖØÐÂÆô¶¯»òÖÕÖ¹·þÎñ³ÌÐò£»Ò»¸ö HUP ÐźÅ
»áʹ·þÎñ³ÌÐòÖØжÁÈ¡ÆäÅäÖõµ¶øÒ»¸ö TERM ÐźŻáʹËüÖÕÖ¹¡£
Èç¹û³ÌÐò²»Õý³£µØËÀµô£¨»ò±»É±µô£©£¬ÄÇ÷á±ØÐëɱµô httpd ×Ó³ÌÐò¡£
2.4.2 ´íÎó¼Ç¼
·þÎñÆ÷»á½«´íÎóѶϢ¼Ç¼µ½Ò»¸ö¼Ç¼µµÈ¥£¬Ô¤ÉèΪ log/error_log ¡£
ÎļþÃû³Æ¿ÉÒÔ½åÓÉ ErrorLog Ö¸ÁîÉ趨£»¿ÉÒÔΪ²»Í¬µÄÐéÄâÖ÷»úÉ趨²»
ͬµÄ´íÎó¼Ç¼¡£
2.4.3 ´«Êä¼Ç¼
·þÎñÆ÷Ò»°ã»á½«Ã¿¸öÇëÇó¼Ç¼µ½Ò»¸ö´«Êäµµ£¬Ô¤ÉèΪ logs/access_log
¡£ÎļþÃû³Æ¿ÉÒÔ½åÓÉ TransferLog Ö¸ÁîÉ趨£»¿ÉÒÔΪ²»Í¬µÄÐéÄâÖ÷»ú
É趨²»Í¬µÄ´«Êä¼Ç¼¡£
µÚÈýÕÂ
°¢ÅÁÆæºËÐIJ¿·Ý(core)µÄÌØÉ«
ÕâЩÅäÖòÎÊý¿ØÖƺËÐIJ¿·ÝµÄ°¢ÅÁÆæÌØÉ«£¬¶øÇÒÊǹ̶¨¿ÉÒÔʹÓõġ£
3.1 AccessConfig Ö¸Áî
Óï·¨: AccessConfig ÎļþÃû³Æ
Ô¤Éè: AccessConfig conf/access.conf
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
´Ë·þÎñÆ÷¶ÁÈ¡ ResourceConfig ÎļþÖ®áὫ»á¼ÌÐø¶ÁÈ¡Õâ¸öÎļþÒÔÈ¡µÃ
¸ü¶àÖ¸Áî¡£ÎļþÃû³ÆϵÏà¶Ôì¶ ServerRoot ·¾¶¡£´ËÌØÉ«¿ÉÒÔʹÓÃÈçÏÂ
µÄ·½Ê½¹Ø±Õ:
AccessConfig /dev/null
Ô±¾Õâ¸öÎļþÖ»°üº¬ <Directory> ½ÚÇø£»ÊÂʵÉÏËüÏÖÔÚ¿ÉÒÔ°üº¬ÈκÎ
¿ÉÒÔÓÃ춷þÎñÆ÷ÅäÖõÄÖ¸Áî¡£
3.2 AccessFileName Ö¸Áî
Óï·¨: AccessFileName ÎļþÃû³Æ
Ô¤Éè: AccessFileName .htaccess
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
»Ø´«Îļþ¸ø¿Í»§¶ËµÄʱºò£¬Èç¹ûĿ¼µÄ´æÈ¡¿ØÖƵµÓÐÆô¶¯£¬·þÎñÆ÷»áÔÚ
µ½´ïÕâ·ÝÎļþµÄ·¾¶ÖеÄÿ¸öĿ¼ÀïÒÔ´ËÃû³ÆËÑÑ°´æÈ¡¿ØÖƵµ¡£ÀýÈç:
AccessFileName .acl
Ôڻش« /usr/local/web/index.html Õâ·ÝÎļþÇ°£¬´Ë·þÎñÆ÷½«»á¶ÁÈ¡
/.acl, /usr/.acl, /usr/local/.acl ÒÔ¼° /usr/local/web/.acl ÒÔ
È¡µÃÖ¸Á³ý·ÇÒÔÈçϵķ½Ê½¹Ø±ÕËüÃÇ:
<Directory />
AllowOverride None
</Directory>
3.3 AllowOverride Ö¸Áî
Óï·¨: AllowOverride override override ...
Ô¤Éè: AllowOverride All
ÓÃì¶: directory
״̬: ºËÐÄ
·þÎñÆ÷ÕÒµ½ AccessFileName Ö¸¶¨µÄÎļþʱ»áÐèÒªÖªµÀ¸ÃÎļþËùÐû¸æµÄ
ÄÄЩָÁî¿ÉÒԸıäÉÔÔçµÄ´æÈ¡×ÊѶ¡£
Override ¿ÉÒÔÉèΪ None ÔÚ´ËÇé¿öÏ·þÎñÆ÷½«²»»á¶ÁÈ¡¸Ãµµ£¬¶øÉèΪ
All µÄ»°·þÎñÆ÷½«»áÔÊÐíËùÓеÄÖ¸Á»òÊÇÏÂÁÐÆäÖÐÖ®Ò»:
AuthConfig
ÔÊÐíÑéÈÏÖ¸ÁîµÄʹÓÃ(AuthDBMGroupFile, AuthDBMUserFile,
AuthGroupFile, AuthName, AuthType, AuthUserFile and
require)
FileInfo
ÔÊÐí¿ØÖÆÎļþÐÍָ̬֮ÁîµÄʹÓÃ(AddEncoding, AddLanguage,
AddType, DefaultType and LanguagePriority)
Indexes
ÔÊÐí¿ØÖÆĿ¼Ë÷ÒýÖ®Ö¸ÁîµÄʹÓÃ(AddDescription, AddIcon,
AddIconByEncoding, AddIconByType, DefaultIcon,
DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore,
IndexOptions and ReadmeName)
Limit
ÔÊÐí¿ØÖÆ´æÈ¡Ö÷»úÖ®Ö¸ÁîµÄʹÓÃ(allow, deny and order)
Options
ÔÊÐí¿ØÖÆÌض¨Ä¿Â¼ÌØÉ«Ö®Ö¸ÁîµÄʹÓÃ(Options and XbitHack)
3.4 AuthName Ö¸Áî
Óï·¨: AuthName ÑéÈÏÁìÓò
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: ºËÐÄ
Õâ¸öÖ¸ÁîΪij¸öĿ¼É趨ÑéÈÏÇøÓòµÄÃû³Æ¡£Õâ¸öÇøÓò»áË͸ø¿Í»§¶ËËùÒÔ
ʹÓÃÕßÖªµÀÒª´«Ë͵ÄʹÓÃÕßÃû³ÆÒÔ¼°ÃÜÂë¡£Ëü±ØÐë½åÓÉ AuthType ÒÔ¼°
require Ö¸ÁîÀ´Íê³É£¬¶øÇÒÒªÓÐÏñ AuthUserFile ÒÔ¼° AuthGroupFile
ÕâЩָÁîÅäºÏÔË×÷¡£
3.5 AuthType Ö¸Áî
Óï·¨: AuthType ÐÍ̬
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: ºËÐÄ
Õâ¸öÖ¸ÁîΪij¸öĿ¼ѡÔñʹÓÃÕâÑéÈÏÐÍ̬¡£Ä¿Ç°Ö»ÓÐ Basic ʵ×÷³öÀ´
¡£Ëü±ØÐë½åÓÉ AuthName ÒÔ¼° require Ö¸ÁîÀ´Íê³É£¬¶øÇÒ»¹ÒªÓÐÏñÊÇ
AuthUserFile ÒÔ¼° AuthGroupFile ÕâЩָÁîÅäºÏÔË×÷¡£
3.6 BindAddress Ö¸Áî
Óï·¨: BindAddress ·þÎñÆ÷λַ
Ô¤Éè: BindAddress *
ÓÃì¶: server config
״̬: ºËÐÄ
һ̨ Unix µÄ http ·þÎñÆ÷¿ÉÒÔ¼àÌýµ½¸Ã·þÎñ»úÆ÷ÿ¸ö IP λַµÄÁ¬Ïß
»òÕßÖ»×¢Òâ¸Ã·þÎñ»úÆ÷µÄÒ»¸öλַ¡£·þÎñÆ÷λַ¿ÉÒÔÊÇ:
¡£*
¡£Ò»¸ö IP λַ
¡£Ò»¸öÍêÕûµÄÍø¼ÊÍø·ÁìÓòÃû³Æ
Èç¹û´ËÖµÊÇ * µÄ»°£¬ÄÇ÷á¸Ã·þÎñÆ÷½«»á¼àÌýÿһ¸ö IP λַµÄÁ¬Ïߣ¬
·ñÔòËü½«Ö»¼àÌýÖ¸¶¨µÄ IP λַ¡£
Õâ¸öÑ¡Ïî¿ÉÒÔÓÃÀ´×÷ΪÁíÒ»ÖÖÖ§Ô®ÐéÄâÖ÷»úµÄ·½Ê½È¡´ú <VirtualHost>
½Ú¶Î¡£
3.7 DefaultType Ö¸Áî
Óï·¨: DefaultType mime-ÐÍ̬
Ô¤Éè: DefaultType text/html
ÓÃì¶: server config, virtual host, directory, .htacess
ÐèÇó: FileInfo
״̬: ºËÐÄ
ÓÐЩʱºò·þÎñÆ÷»á±»ÒªÇóÌṩij·ÝÎļþ£¬´ËÎļþ²»ÄܽåÓÉÆä MIME ÐÍ̬
¶ÔÓ³À´¾ö¶¨ÐÍ̬¡£
·þÎñÆ÷±ØÐëÖª»á¿Í»§¶ËÎļþËù°üº¬µÄÐÍ̬(content-type)£¬ËùÒÔ²»ÖªµÀ
ÐÍ̬µÄʱºòËü±ãʹÓà DefaultType ¡£ÀýÈç:
DefaultType image/gif
¶Ô춰üº¬Ðí¶àûÓÐ .gif ¸±ÎļþÃûµÄ gif ͼÐÎĿ¼ÊǺÏÊʵġ£
3.8 <Directory> Ö¸Áî
Óï·¨: <Directory Ŀ¼> ... </Directory>
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
<Directory> ÒÔ¼° </Directory> ÓÃÀ´°ÑÒ»×éÖ¸Áî°ü×°ÆðÀ´£¬ÕâЩָÁî
½«Ö»Ó¦Óõ½ËùÖ¸Ã÷µÄĿ¼¼°Æä×ÓĿ¼ÉÏ¡£ÈκοÉÒÔÓÃì¶ directory µÄ
Ö¸Á¿ÉÒÔʹÓá£Directory Êǵ½Ä³Ä¿Â¼µÄÍêÕû·¾¶£¬»òÊÇÌæ´ú×ÖÔª´®
(widecard string) ¡£ÔÚÌæ´ú×ÖÔª´®ÖÐ `?' Äܹ»·ûºÏÈκε¥Ò»×ÖÔª£¬
¶ø `*' Äܹ»·ûºÏÈκÎ˳ÐòµÄһЩ×ÖÔª¡£ÀýÈç:
<Directory /usr/local/htppd/htdocs>
Option Indexes FollowSymLinks
</Directory>
Èç¹ûÓжà¸ö directory ½ÚÇøÄÜ·ûºÏ°üº¬¸ÃÎļþµÄĿ¼£¨»òÆ丸Ŀ¼£©
£¬ÄÇ÷á·Ö²¼ÔÚ .htaccess ÎļþÀïµÄÖ¸ÁîÊÇÒÔ×î¶ÌÏÈ·ûºÏµÄ˳Ðò¼ÓÒÔÓ¦
Óõģ¬ÀýÈç:
<Directory />
AllowOverride None
</Directory>
<Directory /hoem/*>
AllowOverride FileInfo
</Directory>
´æÈ¡ /home/web/dir/doc.html Õâ·ÝÎļþµÄ²½ÖèÊÇ:
¡£Ó¦Óà AllowOverride None Ö¸Á¹Øµô .htaccess Îļþ£©¡£
¡£Ó¦Óà AllowOverride FileInfo Ö¸ÁĿ¼ /home/web £©¡£
¡£Ó¦ÓÃÈκÎÔÚ /home/web/.htaccess ÀïÃæµÄ FileInfo Ö¸Áî¡£
Õâ¸ö directory ½Ú¶ÎµäÐÍÊÇÓÃÔÚ access.conf ÎļþÀµ«ËüÃÇ¿ÉÒÔ
³öÏÖÔÚÈκÎÅäÖõµÀï¡£<Directory> Ö¸Áî²»Äܳ²×´Ê¹Ó㬶øÇÒ²»ÄܳöÏÖ
ÔÚ <Limit> ½Ú¶ÎÀï¡£
3.9 DocumentRoot Ö¸Áî
Óï·¨: DocumentRoot Ŀ¼Ãû³Æ
Ô¤Éè: DocumentRoot /usr/local/etc/httpd/htdocs
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
Õâ¸öÖ¸ÁîÉ趨 httpd ´ÓÕâ¸öĿ¼ÌṩÎļþ·þÎñ¡£³ý·Ç·ûºÏÏñÊÇ Alias
ÕâÑùµÄÖ¸Á·þÎñÆ÷°ÑËùÒªÇóµÄ URL ¸½¼Óµ½Îļþ¸ù (document root)
À´×éºÏµ½´ïÎļþµÄ·¾¶¡£ÀýÈç:
DocumentRoot /usr/web
Èç´Ë¶Ôì¶ http://www.my.host.com/index.html ÎļþµÄ´æÈ¡±ã»á²ÎÕÕ
µ½ /usr/web/index.html ¡£
3.10 ErrorDocument Ö¸Áî
Óï·¨: ErrorDocument ´íÎó´úÂë Îļþ
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
ÓÐÎÊÌâ»ò´íÎó·¢ÉúµÄ×´¿öÏ£¬¿ÉÒÔÅäÖð¢ÅÁÆæ×öËÄÖÖ·´Ó¦
1. Èçͬ NCSA httpd 1.3 µÄ·´Ó¦
2. Êä³ö×Ô¶¨µÄ(customized)ѶϢ
3. Öص¼µ½Ä³¸ö±¾µØµÄ URL ÒÔ´¦Àí¸ÃÎÊÌ⣯´íÎó
4. Öص¼µ½Ä³¸öÍⲿµÄ URL ÒÔ´¦Àí¸ÃÎÊÌ⣯´íÎó
2-4 ÊÇʹÓà ErrorDocument À´ÅäÖã¬Æäáá¸úËæ HTTP ·´Ó¦ÂëÒÔ¼°Ñ¶Ï¢
»òÊÇ URL ¡£
ErrorDocument 500 /cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 http://www.foo.bar/subscription_info.html
ErrorDocument 403 "Sorry can't allow you acess today
²ÎÔÄ: ×Ô¶¨»ØÓ¦µÄÎļþ¡£
3.11 ErrorLog Ö¸Áî
Óï·¨: ErrorLog ÎļþÃû³Æ
Ô¤Éè: ErrorLog logs/error_log
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
Õâ¸ö´íÎó¼Ç¼ָÁîÉ趨ÎļþÃû³Æ£¬·þÎñÆ÷½«»á°ÑÆäÔâÓöµÄÿ¸ö´íÎó¼Ç¼
µ½Õâ¸öÎļþÈ¥¡£Èç¹ûÎļþÃû³Æ²»ÊÇÒÔ / ¿ªÊ¼µÄ»°ÄÇ÷áËü¾Í»á±»¼ÙÉèΪ
Ïà¶Ôì¶ ServerRoot µÄ·¾¶¡£ÀýÈç:
ErrorLog /dev/null
Õâ»áÓÐЧµØ¹Øµô´íÎó¼Ç¼¡£
3.12 Group Ö¸Áî
Óï·¨: Group unix-Ⱥ×é
Ô¤Éè: Group #-1
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö Group Ö¸ÁîÉ趨·þÎñÆ÷»Ø´ðÒªÇóʱËù´¦µÄȺ×顣ΪÁËÒªÄܹ»Ê¹ÓÃ
Õâ¸öÖ¸Á±ØÐëÒÔ root Éí·ÖÆðʼִÐжÀÁ¢µÄ·þÎñÆ÷¡£ Unix-Ⱥ×é¿ÉÒÔ
ÊÇÕâЩÆäÖÐÖ®Ò»:
Ⱥ×éµÄÃû³Æ
½åÓÉÃû³Æ²ÎÕÕËù¸øµÄȺ×é¡£
# ¸úËæÖøȺ×éºÅÂë
½åÓɺÅÂë²ÎÕÕij¸öȺ×é¡£
½¨ÒéÄãÌرðÉèÁ¢Ò»¸öȺ×éÀ´Ö´ÐÐÕâ¸ö·þÎñÆ÷¡£Ä³Ð©¹ÜÀíÕßʹÓà nobody
Õâ¸öʹÓÃÕߣ¬µ«ÊÇÕâ²¢·ÇÓÀÔ¶¿ÉÐлòºÏÊʵġ£
×¢Òâ: Èç¹ûÄãÒÔ·Ç root ʹÓÃÕßµÄÉí·ÖÆô¶¯Õâ¸ö·þÎñÆ÷£¬Ëü½«ÎÞ·¨Çл»
µ½Ö¸¶¨µÄȺ×飬²¢ÇÒÈ¡¶ø´úÖ®µÄÊÇËü½«»á¼ÌÐøÒÔÔÀ´µÄʹÓÃÕßËùÊôȺ×é
À´Ö´ÐС£
°²È«: ²ÎÔÄ User Ö¸Áî¶Ô°²È«Çé¿öµÄÌÖÂÛ¡£
3.13 IdentityCheck Ö¸Áî
Óï·¨: IdentifyCheck ²¼ÁÖÖµ
Ô¤Éè: IdentifyCheck off
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸öÖ¸ÁîΪÿ´ÎµÄÁ¬ÏßÆðʼ RFC931-ÏàÈݵÄÔ¶¶ËʹÓÃÕßÃû³Æ¼Ç¼£¬ÆäÖÐ
¿Í»§¶ËÐèµÃÖ´ÐÐ identd »òÕßÊÇÀàËƵĶ«Î÷¡£ÕâÏî×ÊѶ¼Ç¼ÔÚ´æÈ¡¼Ç¼
(access log)Àï¡£²¼ÁÖÖµÊÇ on »òÕß off ¡£
³ý·ÇÊÇ×÷Ϊ»ù±¾µÄʹÓÃÁ¿×·×Ù£¬ÕâÏî×ÊѶÎÞÂÛÈçºÎ²»ÄÜÕæµÄÐÅÀµ¡£
3.14 <Limit> Ö¸Áî
Óï·¨: <Limit ·½Ê½ ·½Ê½ ... > ... </Limit>
ÓÃì¶: Èκεط½
״̬: ºËÐÄ
<limit> ÒÔ¼° </Limit> ÓÃÀ´°ÑÒ»×é´æÈ¡¿ØÖÆÖ¸Áî°ü×°ÆðÀ´£¬ÕâЩָÁî
½«Ö»Ó¦Óõ½Ö¸¶¨µÄ´æÈ¡·½Ê½ÉÏ£¬ÆäÖеķ½Ê½ÊÇÖ¸ÈκÎÓÐЧµÄ HTTP ·½Ê½
(method)¡£³ýÁË <Limit> »òÊÇ <Directory> Ö®ÍâµÄÈκÎÖ¸Á¿ÉÒÔ
ʹÓ㻴󲿷ֶ¼²»»á±» <Limit> Ó°Ïì¡£ÀýÈç:
<Limit GET POST>
require valid-user
</Limit>
Èç¹ûÓиö´æÈ¡¿ØÖÆÖ¸Áî³öÏÖÔÚ <Limit> Ö¸ÁîÖ®Í⣬ÄÇ÷áËü»á±»Ó¦Óõ½
ËùÓеĴæÈ¡·½Ê½ÉÏ¡£
3.15 MaxClient Ö¸Áî
Óï·¨: MaxClients Êý×Ö
Ô¤Éè: MaxClients 150
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö MaxClients Ö¸ÁîÉ趨ËùÄÜÖ§Ô®µÄͬʱ´æÈ¡ÒªÇóÊýÄ¿£»²»»á½¨Á¢±È
´ËÖµ»¹¶àµÄ×Ó³ÌÐò¡£
3.16 MaxRequestPerChild Ö¸Áî
Óï·¨: MaxRequestsPerChild Êý×Ö
Ô¤Éè: MaxRequestsPerChild 0
ÓÃì¶: server config
״̬: ºËÐÄ
MaxRequestsPerChild Õâ¸öÖ¸ÁîÉ趨һ¸ö¶ÀÁ¢µÄ×Ó·þÎñ³ÌÐò½«ÄÜ´¦ÀíµÄ
ÇëÇóÊýÁ¿¡£ÔÚ´¦Àí MaxRequestsPerChild ¸öÇëÇóÖ®áᣬ×Ó³ÌÐò½«»á±»
ÖÕÖ¹¡£Èç¹û MaxRequestsPerChild Ϊ 0 µÄ»°£¬ÄÇ÷á¸Ã³ÌÐòÓÀÔ¶²»»á
±»ÖÕÖ¹¡£
MaxRequestsPerChild ÉèΪ·Ç 0 µÄÖµ×öΪÏÞÖÆÓÐÁ½¸öºÃ´¦:
¡£½åÓɼÇÒäÌåʹÓÃÁ¿ÏÞÖƳÌÐòʹÓõļÇÒäÌåÊýÁ¿£»
¡£½åÓɸ³Óè³ÌÐòÓÐÏ޵ĴæÁôʱ¼ä£¬¿ÉÒÔÔÚ·þÎñÆ÷¸ºÔؽµµÍʱÐÖú
¼õÉÙ³ÌÐòµÄÊýÄ¿¡£
3.17 MaxSpareServers Ö¸Áî
Óï·¨: MaxSpareServers Êý×Ö
Ô¤Éè: MaxSpareServers 10
ÓÃì¶: server config
״̬: ºËÐÄ
MaxSpareServers Õâ¸öÖ¸ÁîÉ趨×î´óÏÐÖÃ(idle)×Ó·þÎñ³ÌÐòÊýÁ¿¡£ÏÐÖÃ
×Ó·þÎñ³ÌÐòÊÇĿǰûÓд¦ÀíÒªÇóµÄ³ÌÐò¡£Èç¹ûÓжàì¶ MaxSpareServers
µÄÔÝÍ£³ÌÐò£¬ÄÇ÷Ḹ³ÌÐò»áÖÕÖ¹³¬¹ý´ËÊýÁ¿µÄ×Ó³ÌÐò¡£
Ö»ÓÐÔڷdz£Ã¦ÂµµÄվ̨ÉϲÅÓе÷ÕûÕâ¸öÑ¡ÏîµÄÐèÒª¡£°ÑÕâ¸ö²ÎÊýÉèΪ·Ç
³£´óµÄÊýĿͨ³£×ÜÊǸö²»ºÃµÄÖ÷Òâ¡£
²ÎÔÄ MinSpareServers ÒÔ¼° StartServers ¡£
3.18 MinSpareServers Ö¸Áî
Óï·¨: MinSpareServers Êý×Ö
Ô¤Éè: MinSpareServers 5
ÓÃì¶: server config
״̬: ºËÐÄ
MinSpareServers Õâ¸öÖ¸ÁîÉ趨×î´óÏÐÖÃ(idle)×Ó·þÎñ³ÌÐòÊýÁ¿¡£ÏÐÖÃ
×Ó·þÎñ³ÌÐòÊÇĿǰûÓд¦ÀíÒªÇóµÄ³ÌÐò¡£Èç¹ûÓÐÊôì¶ MinSpareServers
µÄÔÝÍ£³ÌÐò£¬ÄÇ÷Ḹ³ÌÐò»áÒÔ×î¸ßÿÃëÒ»¸öµÄËÙÂʽ¨Á¢ÐµÄ×Ó³ÌÐò¡£
Ö»ÓÐÔڷdz£Ã¦ÂµµÄվ̨ÉϲÅÓе÷ÕûÕâ¸öÑ¡ÏîµÄÐèÒª¡£°ÑÕâ¸ö²ÎÊýÉèΪ·Ç
³£´óµÄÊýĿͨ³£×ÜÊǸö²»ºÃµÄÖ÷Òâ¡£
²ÎÔÄ MaxSpareServers ÒÔ¼° StartServers ¡£
3.19 Options Ö¸Áî
Óï·¨: Option Ñ¡Ïî Ñ¡Ïî ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Options
״̬: ºËÐÄ
Options Õâ¸öÖ¸Áî¿ØÖÆij¸öÌض¨Ä¿Â¼ËùÄÜʹÓõķþÎñÆ÷ÌØÉ«¡£Ñ¡Ïî¿ÉÒÔ
ÉèΪ NONE ÔÚ´ËÇé¿öÏÂûÓжîÍâµÄÌØÉ«»áÆ𶯣¬»òÕß¿ÉÒÔÊÇÏÂÁеÄÒ»¸ö
»ò¼¸¸ö:
All
³ýÁË MultiViews ÒÔÍâµÄËùÓÐÑ¡Ïî¡£
ExecCGI
CGI Ö¸Áî¸åµÄÖ´ÐÐȨÏÞ¡£
FollowSymLinks
·þÎñÆ÷½«»á¸úÕÕĿ¼ÀïµÄ·ûºÅÁ´½á¡£
IncludesNOEXEC
·þÎñ¶Ëº¬Èë(Server-side include) µÄȨÏÞ¡£
Indexes
Èç¹ûÓиö URL ¶ÔÓ³µ½ËùÒªÇóµÄĿ¼£¬¶øÇÒĿ¼ÀïÃ沢ûÓÐĿ¼
Ë÷Òý(DirectoryIndex, e.g. index.html) ´æÔÚ£¬ÄÇ÷á·þÎñÆ÷½«
»á´«»ØÕâ¸öĿ¼¸ñʽ»¯ááµÄÁÐ±í¡£
MultiViews
ÔÊÐí MultiViews ÄÚÈÝÐÉÌ¡£
SymLinksIfOwnerMatch
Ö»ÓÐÔÚÄ¿±êÎļþ»òĿ¼Óë·ûºÅÁ´½áµÄÓµÓÐÕßÏàͬʱ·þÎñÆ÷²Å»áÈ¥
¸úÕÕ·ûºÅÁ´½á¡£
Èç¹û¶à¸öÑ¡Ïî¿ÉÒÔÓ¦Óõ½Ä³¸öĿ¼ÉÏ£¬ÄÇ÷á×îµ×ϵÄÖ¸¶¨»áÍê³É£»Ñ¡Ïî
²»»áºÏ²¢¡£ÀýÈç:
<Directory /web/docs>
Options Indexes FollowSymLinks
</Directory>
<Directory /web/docs/spec>
Option Includes
</Directory>
ÕâÑùÖ»ÓÐ Includes »áÉ趨µ½ /web/docs/spec Ŀ¼ÉÏ¡£
3.20 PidFile Ö¸Áî
Óï·¨: PidFile ÎļþÃû³Æ
Ô¤Éè: PidFile logs/httpd.pid
ÓÃì¶: server config
״̬: ºËÐÄ
PidFile Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷¼Ç¼·þÎñ³ÌÐòµÄ³ÌÐòºÅÂëËùʹÓõÄÎļþ¡£
Èç¹ûÎļþÃû³Æ²»ÊÇÒÔ / ¿ªÊ¼ÄÇ÷áËü»á±»¼Ù¶¨ÊÇÏà¶Ôì¶ ServerRoot µÄ
Ŀ¼¡£Õâ¸ö PidFile ֻʹÓÃÔÚ¶ÀÁ¢(standalone)ģʽ¡£
Äܹ»Ë͸öÐźŸø·þÎñÆ÷ͨ³£»áÊÇÓÐÓõģ¬¿ÉÒԹرÕÔÙÖØдò¿ª´íÎó¼Ç¼
Óë´«Êä¼Ç¼£¬ÒÔ¼°ÖØжÁÈ¡ÅäÖõµ¡£ÕâÊǽåÓÉ´«ËÍ SIGHUP (kill -1)
Ðźŵ½ÁÐÔÚ PidFile ÀïµÄ³ÌÐòºÅÂëÀ´´ï³ÉµÄ¡£
3.21 Port Ö¸Áî
Óï·¨: Port Êý×Ö
Ô¤Éè: Port 80
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö Port Ö¸ÁîÉ趨·þÎñÆ÷¼àÌýµÄÍø·¶Ë¿ÚºÅ¡£Êý×ÖÊÇ 0 µ½ 65535 µÄ
Ò»¸öÊýÄ¿£»Ä³Ð©¶Ë¿ÚºÅ£¨ÌرðÊǵÍì¶ 1024 µÄ£©±£Áô¸øÌØÊâµÄж¨¡£²ÎÔÄ
/etc/services ÀﶨÒåµÄһЩ¶Ë¿ÚµÄÁÐ±í£»±ê×¼ http ж¨Ê¹Óà 80 ¶Ë¿Ú¡£
Port 80 ÊÇ Unix's µÄÒ»¸öÌرð¶Ë¿Ú¡£ËùÓеÍì¶ 1024 µÄ¶Ë¿ÚºÅ¶¼ÊDZ£Áô¸ø
ϵͳʹÓõģ¬ÀýÈ磬һ°ãʹÓÃÕß(non-root)²»ÄÜʹÓÃËüÃÇ£»È¡¶ø´úÖ®µÄ
ÊÇËûÃÇ¿ÉÒÔʹÓýϸߵĶ˿ںš£
ҪʹÓà 80 ¶Ë¿ÚÄã±ØÐëÒÔ root ÕʺÅÆô¶¯·þÎñÆ÷¡£ÔÚÁ¬½Óµ½¸Ã¶Ë¿Úáᣬ½ÓÊÜ
ÇëÇó֮ǰ£¬°¢ÅÁÆ潫»áÇл»Îª½åÓÉ User Ö¸ÁîËùÉ趨ȨÏ޽ϵ͵ÄʹÓÃÕß
Éí·Ö¡£
Èç¹ûÄã²»ÄÜʹÓà 80 ¶Ë¿Ú£¬Ñ¡ÔñÈκÎÆäËüûÓÐʹÓõ½µÄ¶Ë¿Ú¡£·Ç root ʹÓÃ
Õß±ØÐëÑ¡Ôñ¸ßì¶ 1023 µÄ¶Ë¿ÚºÅ£¬ÏñÊÇ 8000 ¡£
°²È«: Èç¹ûÄãÊÇÒÔ root Æô¶¯·þÎñÆ÷£¬È·¶¨²»Òª°Ñ User ÉèΪ root ¡£
Èç¹ûÄãÒÔ root Éí·Ö´¦ÀíÁ¬ÏߵĻ°£¬ÄãµÄվ̨¿ÉÄܻᱩ¶ÔÚ¹¥»÷Ï¡£
3.22 require Ö¸Áî
Óï·¨: require ÏîÄ¿Ãû³Æ ÏîÄ¿ ÏîÄ¿ ...
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: ºËÐÄ
Õâ¸öÖ¸ÁîÑ¡Ôñ¾¹ýÑéÈÏ¿ÉÒÔ´æȡĿ¼µÄʹÓÃÕß¡£ÔÊÐíʹÓõÄÓï·¨ÊÇ:
¡£require user ʹÓÃÕß±æʶÂë ʹÓÃÕß±æʶÂë ...
Ö»ÓÐ×¢Ã÷µÄʹÓÃÕßÄÜ´æÈ¡¸ÃĿ¼¡£
¡£require group Ⱥ×éÃû³Æ Ⱥ×éÃû³Æ ...
Ö»ÓÐÔÚ×¢Ã÷Ⱥ×éÀïµÄʹÓÃÕßÄÜ´æÈ¡¸ÃĿ¼¡£
¡£require valid-user
ËùÓкϷ¨µÄʹÓÃÕ߶¼¿ÉÒÔ´æÈ¡¸ÃĿ¼¡£
Èç¹û require ³öÏÖÔÚ <Limit> ½Ú¶ÎÀÄÇ÷áËü»áÏÞÖÆËù×¢Ã÷µÄ´æÈ¡
·½Ê½£¬·ñÔòËü»áÏÞÖÆËùÓеĴæÈ¡·½Ê½¡£ÀýÈç:
AuthType Basic
AuthName somedomain
AuthUserFile /web/users
AuthGroupFile /web/group
Limit <GET POST>
require group admin
</Limit>
Require ±ØÐë½åÓÉ AuthName ÒÔ¼° AuthType ÕâЩָÁÒÔ¼°ÅäºÏÏñÊÇ
AuthUserFile ÒÔ¼° AuthGroupFile Ö¸ÁÓÃÀ´¶¨ÒåʹÓÃÕßÓëȺ×飩
ÒÔ±ãÕýÈ·ÔË×÷¡£
3.23 ResourceConfig Ö¸Áî
Óï·¨: ResourceConfig ÎļþÃû³Æ
Ô¤Éè: ResourceConfig conf/srm.conf
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
´Ë·þÎñÆ÷¶ÁÈ¡ httpd.conf ÎļþÖ®áὫ»á¼ÌÐø¶ÁÈ¡Õâ¸öÎļþÒÔÈ¡µÃ¸ü¶à
Ö¸Áî¡£ÎļþÃû³ÆϵÏà¶Ôì¶ ServerRoot ·¾¶¡£´ËÌØÉ«¿ÉÒÔʹÓÃÈçϵķ½
ʽ¹Ø±Õ:
ResourceConfig /dev/null
Ô±¾Õâ¸öÎļþ°üº¬´ó²¿·ÖÖ¸Á³ýÁË·þÎñÆ÷ÅäÖü° <Directory> ½ÚÇø
ÒÔÍ⣻ÊÂʵÉÏËüÏÖÔÚ¿ÉÒÔ°üº¬ÈκοÉÒÔÓÃ춷þÎñÆ÷ÅäÖõÄÖ¸Áî¡£
3.24 ServerAdmin Ö¸Áî
Óï·¨: ServerAdmin µç×ÓÓʼþµØÖ·
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
ServerAdmin É趨µç×ÓÓʼþµØÖ·£¬·þÎñÆ÷»Ø´«ÈκδíÎóѶϢ¸ø¿Í»§¶Ëʱ
»á°üº¬Õâ¸öµØÖ·¡£
É趨һ¸öÏñÕâÑùµÄµØÖ·¿ÉÄÜ»áÓÐÓã¬ÀýÈç
ServerAdmin www-admin@foo.bar.com
ÒòΪʹÓÃÕß²¢²»»áÓÀÔ¶ÖªµÀËûÃÇÊǸúÔÚÄĄ̈·þÎñÆ÷´ò½»µÀ!
3.25 ServerName Ö¸Áî
Óï·¨: ServerName ÍêÕûµÄÁìÓòÃû³Æ
ÓÃì¶: server config, virtual host
״̬: ºËÐÄ
Õâ¸ö ServerName Ö¸ÁîÉ趨·þÎñÆ÷µÄÖ÷»úÃû³Æ£»ÕâÖ»ÓÐÔÚ½¨Á¢Öص¼ URL
µÄʱºòʹÓá£Èç¹ûûÓÐÖ¸¶¨Ëü£¬ÄÇ÷á·þÎñÆ÷»áÊÔͼ´ÓÆä IP λַÀ´¾ö¶¨
£»È»¶øÕâ¸ö·½·¨¿ÉÄܲ»ÄÜÐÅÀµ£¬»òÕßÎÞ·¨»Ø´«Êʵ±µÄÖ÷»úÃû³Æ¡£ÀýÈç:
ServerName www.wibble.com
Èç¹ûÕýʽ(canonical) Ãû³ÆÊÇ monster.wibble.com Ëü»¹Äܹ»Ê¹ÓÃÉÏÊö
µÄÃû³Æ¡£
3.26 ServerRoot Ö¸Áî
Óï·¨: ServerRoot Ŀ¼Ãû³Æ
Ô¤Éè: ServerRoot /usr/local/etc/httpd
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö ServerRoot Ö¸ÁîÉ趨·þÎñÆ÷ËùÔÚµÄĿ¼¡£ËüµäÐÍ»á°üº¬ÓÐ×ÓĿ¼
conf/ ÒÔ¼° logs/ ¡£ÆäËüÅäÖõµµÄÏà¶Ô·¾¶ÊÇÏà¶Ôì¶Õâ¸ö·¾¶¡£
3.27 ServerType Ö¸Áî
Óï·¨: ServerType ÐÍ̬
Ô¤Éè: ServerType standalone
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö ServerType Ö¸ÁîÉ趨ϵͳÈçºÎÖ´ÐÐÕâ¸ö·þÎñÆ÷¡£ÐÍ̬¿ÉÒÔÊÇÆäÖÐ
Ö®Ò»:
inetd
·þÎñÆ÷½«ÓÉϵͳ³ÌÐò inetd Ö´ÐУ»Æô¶¯·þÎñÆ÷ʹÓõÄÃüÁî¼ÓÔÚ
/etc/inetd.conf ÎļþÀï¡£
standalone
·þÎñÆ÷½«»á×÷Ϊ·þÎñ³ÌÐò(daemon)Ö´ÐУ»Æô¶¯·þÎñÆ÷ʹÓõÄÃüÁî
¼ÓÔÚϵͳÆô¶¯Ö¸Áî¸åÀï(/etc/rc.local or /etc/rc.d/...)¡£
inetd ÔÚÕâÁ½¸öÑ¡ÏîÀïÊǽÏÉÙʹÓõġ£ÒòΪ½ÓÊÕµ½Ã¿¸ö http Á¬Ï߾ͻá
ÖØÍ·¿ªÊ¼Ö´ÐÐÒ»·ÝеķþÎñÆ÷¿½±´£»Á¬Ïß½áÊøáᣬÕâÖ§³ÌÐò¾Í»á½áÊø¡£
ÿ´ÎÁ¬ÏßÒª¸¶³öµÄ´ú¼ÛºÜ¸ß£¬µ«ÊÇÒòΪ°²È«ÉϵÄÀíÓÉ£¬Ä³Ð©¹ÜÀíÕßϲ»¶
Õâ¸öÑ¡Ïî¡£
standalone ÊÇ ServerType ʹÓÃ×îÆÕ±éµÄÉ趨£¬ÒòΪËü¸üΪÓÐЧÂÊ¡£
·þÎñÆ÷Æô¶¯Ò»´Î£¬¶øÇÒ·þÎñËùÓеÄÁ¬Ïß¡£Èç¹ûÄãÏëÒªÖ´Ðа¢ÅÁÆæÀ´·þÎñ
Ò»¸öæµµÄվ̨£¬ standalone ´ó¸Å½«»áÊÇÄãΨһµÄÑ¡Ôñ¡£
°²È«: Èç¹ûÄã¶Ô°²È«ÐÔÓÐÆ«Ö´£¬ÒÔ inetd ģʽÀ´Ö´ÐÐËü¡£Á½ÖÖ·½Ê½¶¼
²»Äܾø¶ÔÈ·±£°²È«ÐÔ£¬µ«ÊǴ󲿷ÖÈËʹÓà standalone ÓõúܸßÐËʱ£¬
inetd ´ó¸Å±È½Ï²»»áÔâµ½¹¥»÷¡£
3.28 StartServers Ö¸Áî
Óï·¨: StartServers Êý×Ö
Ô¤Éè: StartServers 5
ÓÃì¶: server config
״̬: ºËÐÄ
Õâ¸ö StartServers Ö¸ÁîÉ趨Æô¶¯Ê±½¨Á¢µÄ×Ó·þÎñ³ÌÐòÊýÁ¿¡£ÒòΪ³ÌÐò
µÄÊýÁ¿ÊÇÒÀ¾Ý¸ºÔض¯Ì¬¿ØÖƵģ¬Í¨³£Ã»ÓÐʲ÷áÀíÓɵÃÒªµ÷ÕûÕâ¸ö²ÎÊý¡£
²ÎÔÄ MinSpareServers ÒÔ¼° MaxSpareServers ¡£
3.29 TimeOut Ö¸Áî
Óï·¨: TimeOut Êý×Ö
Ô¤Éè: TimeOut 1200
ÓÃì¶: server config
״̬: ºËÐÄ
TimeOut Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷½ÓÊÕÒ»¸öÇëÇóÒÔ¼°Íê³ÉÒ»¸öÇëÇó×µÄµÈ
´ýʱ¼ä£¬ÒÔÃëΪµ¥Î»¡£ËùÒÔÈç¹ûËü»¨·Ñ±È TimeOut ¸ü¶àÃëÀ´Èÿͻ§¶Ë
´«ËÍÇëÇó»ò½ÓÊÕ»ØÓ¦£¬·þÎñÆ÷½«»áÖжϸÃÁ¬Ïß¡£Òò´Ë TimeOut ÏÞÖÆÒ»
´Î¿ÉÒÔ´«ÊäµÄ×î´ó×ÊÁÏÁ¿£»¶Ô춴óÎļþ£¬ÒÔ¼°ÂýËÙÍø·´«Êäʱ¼ä¿ÉÄÜ»á
ºÜ¾Ã¡£
3.30 User Ö¸Áî
Óï·¨: User ʹÓÃÕß±æʶÂë
Ô¤Éè: User #-1
ÓÃì¶: server config
״̬: ºËÐÄ
User Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷ÓÃÀ´»Ø´ðÇëÇóµÄʹÓÃÕß±æʶÂ롣ΪÁËÒªÄܹ»
ʹÓÃÕâ¸öÖ¸Á±ØÐëÒÔ root Éí·ÖÆðʼִÐжÀÁ¢µÄ·þÎñÆ÷¡£UnixʹÓÃÕß
±æʶÂë¿ÉÒÔÊÇÆäÖÐÖ®Ò»:
Ò»¸öʹÓÃÕßÃû³Æ
½åÓÉÃû³Æ²ÎÕÕ¸ø¶¨µÄʹÓÃÕß¡£
# ¸úËæÖøʹÓÃÕß±àºÅ
½åÓÉʹÓÃÕâ¸ö±àºÅ²ÎÕÕËûÃÇ¡£
Õâ¸öʹÓÃÕßÓ¦¸Ã²»ÄÜÓдæÈ¡Íâ½çËù²»ÄÜ¿´µ½µÄÎļþµÄȨÏÞ£¬¶øÇÒÓë´ËÀà
ËÆ£¬Õâ¸öʹÓÃÕßÓ¦¸Ã²»ÄÜÖ´ÐÐ¶Ô httpd ÒªÇó¶øÑÔûÓÐÒâÒåµÄ³ÌÐòÂë¡£
½¨ÒéÄãÌرðΪִÐÐÕâ¸ö·þÎñÆ÷ÉèÁ¢ÐµÄʹÓÃÕßÒÔ¼°Èº×顣ijЩ¹ÜÀíÕßʹ
Óà nobody µ«ÊÇÕâ²¢·ÇÓÀÔ¶¿ÉÐлòºÏÊʵġ£
×¢Òâ: Èç¹ûÄãÒÔ·Ç root ʹÓÃÕßµÄÉí·ÖÆô¶¯Õâ¸ö·þÎñÆ÷£¬Ëü½«ÎÞ·¨Çл»
µ½È¨Ï޽ϵ͵ÄʹÓÃÕߣ¬²¢ÇÒÈ¡¶ø´úÖ®µÄÊÇËü½«»á¼ÌÐøÒÔÔʹÓÃÕßÉí·ÝÀ´
Ö´ÐС£Èç¹ûÄãÕæµÄÊÇÒÔ root Æô¶¯Õâ¸ö·þÎñÆ÷£¬ÄÇ÷áÕâ¸ö¸¸³ÌÐòÒ»°ãÈÔ
È»ÒÔ root Éí·ÖÔÚÖ´ÐС£
°²È«: ²»Òª°Ñ User(or Group) ÉèΪ root ³ý·ÇÄãȷʵ֪µÀÄãÔÚ×öʲ÷á
ÒÔ¼°»áÓÐÔõ÷áÑùµÄΣÏÕ¡£
3.31 <VirtualHost> Ö¸Áî
Óï·¨: <VirtualHost λַ>...</VirtualHost>
ÓÃì¶: ·þÎñÆ÷ÅäÖÃ
λì¶: ºËÐIJ¿·Ý
<VirtualHost> ÒÔ¼° </VirtualHost> ÓÃÀ´°ÑÒ»×éÖ¸Áî°ü×°ÆðÀ´£¬ÕâЩ
Ö¸Áֻ»áÓ¦Óõ½Ä³¸öÌض¨µÄÐéÄâÖ÷»úÉÏ¡£ÈκοÉÓÃì¶ÐéÄâÖ÷»úµÄÖ¸Áî
¶¼¿ÉÒÔʹÓᣵ±·þÎñÆ÷½ÓÊÕµ½Ä³¸öÌض¨Ö÷»úÉϵÄÎļþÇëÇóµÄʱºò£¬Ëü»á
ʹÓðü×°ÔÚ <VirtualHost> ½Ú¶ÎÀïµÄÅäÖÃÖ¸Áλַ¿ÉÒÔÊÇ
¡£ÐéÄâÖ÷»úµÄ IP λַ
¡£ÐéÄâÖ÷»úµÄ IP λַµÄÍêÕûÁìÓòÃû³Æ¡£
¡õÀý:
<VirtualHost host.foo.com>
ServerAdmin webmaster@host.foo.com
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>
Ä¿Ç°£¬Ã¿¶Î VirtualHost ±ØÐë·ûºÏ·þÎñÆ÷²»Í¬µÄ IP λַ£¬ËùÒÔ·þÎñ
»úÆ÷±ØÐëÅäÖóÉÄܹ»½ÓÊÕ¶à¸öλַµÄ IP ·â°ü¡£Èç¹û¸Ã»úÆ÷²¢Ã»Óжà¸ö
Íø·½çÃ棬ÄÇ÷áÕâ¿ÉÒÔÅäºÏ ifconfig alias Ö¸ÁîÀ´Íê³É£¨Èç¹ûÄãµÄ×÷
ҵϵͳ֧ԮÕâ¸ö¹¦ÄÜ£©£¬»òÊÇÅäºÏÏñÊÇ VIF(for SunOS(TM)4.1.x)Ò»Àà
µÄºËÐÄÐÞ²¹µµ¡£
µÚËÄÕÂ
°¢ÅÁÆæ±ê׼ģ×é
4.1 mod_access Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_access.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÈ¥¡£ËüÌá
¹©ÒÔ¿Í»§¶ËÖ÷»úÃû³Æ»ò IP λַΪ»ù´¡µÄ´æÈ¡¿ØÖÆ¡£
4.1.1 allow
Óï·¨: allow from Ö÷»ú Ö÷»ú ...
ÓÃì¶: directory, .htaccess
ÐèÇó: Limit
״̬: »ù´¡
Ä£×é: mod_access
allow Õâ¸öÖ¸ÁîÓ°ÏìÄܹ»´æȡijÌض¨Ä¿Â¼µÄÖ÷»ú£»µäÐÍÊÇÓÃÔÚ <Limit>
½ÚÇøÀï¡£Ö÷»ú¿ÉÒÔÊÇÏÂÁÐÖ®Ò»:
all
ÔÊÐíËùÓеÄÖ÷»ú´æÈ¡¡£
£¨²¿·Ý£©ÁìÓòÃû³Æ
ÔÊÐíÃû³ÆΪ´Ë×Ö´®»òÒÔ´Ë×Ö´®½áÊøµÄÖ÷»ú´æÈ¡¡£
ÍêÕûµÄ IP λַ
ÔÊÐí¸Ã IP λַµÄÖ÷»ú´æÈ¡¡£
²¿·ÝµÄ IP λַ
ij¸ö IP λַµÚÒ»µ½µÚÈý¸öλԪ×飬×÷Ϊ×ÓÍø·ÏÞÖÆÖ®Óá£
¡õÀý:
allow from .ncsa.uiuc.edu
ÔÊÐíÔÚÖ¸¶¨ÁìÓòÀïµÄËùÓÐÖ÷»ú½øÐдæÈ¡¡£
×¢ÒâÕâ±È½ÏµÄÊÇÕû¸öµÄÄÚÈÝ£»ËùÒÔ bar.edu ²»»á·ûºÏ foobar.edu ¡£
²ÎÔÄ deny ÒÔ¼° order Ö¸Áî¡£
4.1.2 deny
Óï·¨: deny from Ö÷»ú Ö÷»ú ...
ÓÃì¶: directory, .htaccess
ÐèÇó: Limit
״̬: »ù´¡
Ä£×é: mod_access
deny Õâ¸öÖ¸ÁîÓ°ÏìÄܹ»´æȡijÌض¨Ä¿Â¼µÄÖ÷»ú£»µäÐÍÊÇÓÃÔÚ <Limit>
½ÚÇøÀï¡£Ö÷»ú¿ÉÒÔÊÇÏÂÁÐÖ®Ò»:
all
¾Ü¾øËùÓеÄÖ÷»ú´æÈ¡
£¨²¿·Ý£©µÄÁìÓòÃû³Æ
¾Ü¾øÃû³ÆΪ´Ë×Ö´®»òÒÔ´Ë×Ö´®½áÊøµÄÖ÷»ú´æÈ¡¡£
ÍêÕûµÄ IP λַ
¾Ü¾ø¸Ã IP λַµÄÖ÷»ú´æÈ¡¡£
²¿·ÝµÄ IP λַ
ij¸ö IP λַµÚÒ»µ½µÚÈý¸öλԪ×飬×÷Ϊ×ÓÍø·ÏÞÖÆÖ®Óá£
¡õÀý:
deny from 16
¾Ü¾øÔÚÖ¸¶¨Íø·ÀïµÄËùÓÐÖ÷»ú½øÐдæÈ¡¡£
×¢ÒâÕâ±È½ÏµÄÊÇÕû¸öµÄÄÚÈÝ£»ËùÒÔ bar.edu ²»»á·ûºÏ foobar.edu ¡£
²ÎÔÄ allow ÒÔ¼° order Ö¸Áî¡£
4.1.3 order
Óï·¨: order ´ÎÐò
Ô¤Éè: order deny, allow
ÓÃì¶: directory, .htaccess
ÐèÇó: Limit
״̬: »ù´¡
Ä£×é: mod_access
order Õâ¸öÖ¸Áî¿ØÖÆÆÀ¹À allow ÒÔ¼° deny Ö¸ÁîµÄ´ÎÐò¡£´ÎÐò¿ÉÒÔÊÇ
ÆäÖÐÖ®Ò»:
deny,allow
ÔÚ allow Ö¸Áî֮ǰÆÀ¹À deny Ö¸Áî
allow,deny
ÔÚ deny Ö¸Áî֮ǰÆÀ¹À allow Ö¸Áî
mutual-failue
Ö»ÓÐÄÇЩ³öÏÖÔÚ allow ÁбíÀï¶øÇÒûÓгöÏÖÔÚ deny ÁбíÀïµÄ
Ö÷»ú¿ÉÒÔ½øÐдæÈ¡¡£
¡õÀý:
order deny,allow deny from all allow from .ncsa.uiuc.edu
ÔÊÐíÔÚ ncsa.uiuc.edu Õâ¸öÁìÓòÀïµÄÖ÷»ú½øÐдæÈ¡£»¾Ü¾øËùÓÐÆäËüµÄ
Ö÷»ú´æÈ¡¡£
4.2 mod_alias Ä£×é
Õâ¸ö mod_alias Ä£×é°üº¬ÔÚ mod_alias.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±à
Òë½øÈ¥¡£ËüÌṩµÄ¹¦ÄÜÊǶÔÓ³Ö÷»úÎļþϵͳµÄ²»Í¬²¿·Ýµ½ÎļþÊ÷È¥£¬¼°
URL תÏò¡£
4.2.1 Alias
Óï·¨: Alias url-·¾¶ Ŀ¼-ÎļþÃû³Æ
ÓÃì¶: server config, virtual host
״̬: »ù´¡
Ä£×é: mod_alias
Alias Õâ¸öÖ¸ÁîʹÎļþ¿ÉÒÔ´æ·ÅÔÚ DocumentRoot Ö®ÍâµÄ±¾µØÎļþϵͳ
Àï¡£ÒÔ url-·¾¶ ¿ªÊ¼µÄ URLs ½«»á±»¶ÔÓ³µ½ÒÔ Ä¿Â¼-ÎļþÃû³Æ ¿ªÊ¼
µÄ±¾µØÎļþÈ¥¡£ÀýÈç:
Alais /image /ftp/pub/image
¶Ôì¶ http://myserver/images/foo.gif µÄÕâ¸öÇëÇó»áʹµÃ·þÎñÆ÷»Ø´«
Îļþ /ftp/pub/image/foo.gif ¡£
²ÎÔÄ ScriptAlias Ö¸Áî¡£
4.2.2 Redirect
Óï·¨: Redirect url-·¾¶ url
ÓÃì¶: server config, virtual host
״̬: »ù´¡
Ä£×é: mod_alias
Redirect Õâ¸öÖ¸Áî¶ÔÓ³¾ÉµÄ URL µ½ÐµÄÈ¥¡£Ð嵀 URLs »á±»»Ø´«¸ø
¿Í»§¶ËÒÔ±ãÅäºÏеÄλַÔٴγ¢ÊÔߢȡ¡£Url-·¾¶ (%-decoded)·¾¶£»
ÈκÎÒÔÕâ¸ö·¾¶×÷Ϊ¿ªÊ¼µÄÎļþÇëÇ󶼽«»Ø´«Ò»¸ö´íÎó²¢Öص¼µ½ÒÔ url
×÷Ϊ¿ªÊ¼µÄÐÂ(%-encoded) url È¥¡£ÀýÈç:
Redirect /service http://foo2.bar.com/service
Èç¹û¿Í»§¶ËÇëÇó http://myserver/service/foo.txt Ôò»á±»¸æÖªÓ¦¸Ã
ߢȡ http://foo2.bar.com/service/foo.txt À´È¡´ú¡£
×¢Òâ: ÎÞÂÛÅäÖõµÀïµÄ´ÎÐòÈçºÎ£¬Redirect Ö¸ÁîÓÅÏÈì¶ Alias ÒÔ¼°
ScriptAlias Ö¸Áî¡£
4.2.3 ScriptAlias
Óï·¨: ScriptAlias url-·¾¶ Ŀ¼-ÎļþÃû³Æ
ÓÃì¶: server config, virtual host
״̬: »ù´¡
Ä£×é: mod_alias
ScriptAlias Õâ¸öÖ¸Áî³ýÁË»¹ÁíÍâ°ÑÄ¿±êĿ¼±ê¼ÇΪ°üº¬ CGI Ö¸Áî¸å
ÒÔÍâÆ书ÄÜÓë Alias Ö¸ÁîÏàͬ£¬ÒÔ url-·¾¶ ×÷Ϊ¿ªÊ¼µÄ URLs ½«»á
±»¶ÔÓ³µ½ÒÔ Ä¿Â¼-ÎļþÃû³Æ ×÷Ϊ¿ªÊ¼µÄÖ¸Áî¸åÈ¥¡£ÀýÈç:
ScriptAlias /cgi-bin/ /web/cgi-bin/
¶Ôì¶ http://myserver/images/foo µÄÕâ¸öÇëÇó»áʹ·þÎñÆ÷È¥Ö´ÐÐÖ¸Áî
¸å /web/cgi-bin/foo ¡£
4.3 mod_asis Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_asis.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÈ¥¡£ËüÊÇΪ
.asis Îļþ¶øÌṩµÄ¡£ÈκΠmime ÐÍ̬Ϊ httpd/send-as-is µÄÎļþ¶¼
½«ÓÉÕâ¸öÄ£×é´¦Àí¡£
4.3.1 Ä¿µÄ
ÔÊÐí¶¨ÒåÎļþµÄÐÍ̬£¬Èç´Ë°¢ÅÁÆæ¿ÉÒÔ²»¼Ó HTTP ±êÍ·(headers) ´«ËÍ
ËüÃÇ¡£
Õâ¿ÉÒÔÓÃÀ´´Ó·þÎñÆ÷´«ËÍÈκÎÐÍ̬µÄ×ÊÁÏ£¬°üÀ¨Öص¼(redirects) ÒÔ¼°
ÆäËüÌØÊâµÄ HTTP »ØÓ¦£¬¶ø²»ÐèÒª cgi-script »òÊÇ nph script ¡£
4.3.2 Ó÷¨
ÔÚ·þÎñÆ÷ÅäÖõµÀ¶¨ÒåÒ»¸ö³ÆΪ httpd/send-as-is µÄ mime ÐÍ̬£¬
ÀýÈç
AddType httpd/send-as-is asia
ÕⶨÒå .asis ¸±ÎļþÃûÊÇÐ嵀 httpd/send-as-is mime ÐÍ̬¡£Èκθ±
ÎļþÃûÊÇ .asis µÄÎļþÄÚÈÝÓÉ°¢ÅÁÆæËͳö¸ø¿Í»§¶Ëʱ¼¸ºõ²»»áÓÐÈκεÄ
¸Ä±ä¡£¿Í»§¶Ë½«ÐèÒª HTTP ±êÍ·À´ÁªÏµ£¬ËùÒÔ±ðÍü¼ÇËüÃÇ¡£ A Status:
ÈÔÈ»ÐèÒª±êÍ·£»´Ë×ÊÁÏÓ¦¸ÃÊÇ 3λÊý×ÖµÄ HTTP »ØÓ¦Â룬¸úËæÒ»¶ÎÎÄ×Ö
ѶϢ¡£
ÕâÀïÓиöʾÀýµµ£¬ÆäÄÚÈÝÊǸæËß¿Í»§¶ËÓиöÎļþ±»Öض¨ÏòËͳö¡£
Status: 302 Now where did I leave that URL
Location: http://xyz.abc.com/foo/bar.html
content-type: text/html
<HTML>
<HEAD>
<TITLE>Lame execuses`R'us</TITLE>
</HEAD>
<BODY>
<H1>Fred's exceptionally wonderful page has moved to
<A HREF="http://xyz.abc.com/foo/bar.html">Joe's</A>site
</H1>
</BODY>
</HTML>
×¢Òâ: ·þÎñÆ÷Ò»¶¨»áÔÚË͸ø¿Í»§¶ËµÄ×ÊÁÏÀï¼ÓÉÏ Date: ÒÔ¼° Server:
±êÍ·£¬ËùÒÔ²»Ó¦¸Ã°üº¬ÔÚÕâ¸öÎļþÀï¡£·þÎñÆ÷²»»á¼ÓÉÏ Last-Modified
±êÍ·£¬ËùÒÔÓ¦¸ÃÒª²Å¶Ô¡£
4.4 mod_auth Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_auth.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£ËüÌṩ
µÄ¹¦ÄÜÊÇʹÓÃÎÄ×ÖÎļþÀ´Ö´ÐÐʹÓÃÕßÑéÈÏ¡£
4.4.1 AuthGroupFile
Óï·¨: AuthGroupFile ÎļþÃû³Æ
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: »ù´¡
Ä£×é: mod_auth
AuthGroupFile Õâ¸öÖ¸ÁîÉ趨һ¸öÎı¾ÎļþµÄÃû³Æ£¬Õâ¸öÎı¾Îļþ°üº¬ÓÃÀ´
Ö´ÐÐʹÓÃÕßÑéÈϵÄʹÓÃÕßȺ×éÁÐ±í¡£ÎļþÃû³ÆÊÇȺ×éÎļþµÄ¾ø¶Ô·¾¶¡£
Õâ¸öȺ×éÎļþµÄÿһÐаüÀ¨Ò»¸öȺ×éÃû³Æ£¬¸úËæÒ»¸öðºÅ£¬ÆäááÊǽåÓÉ
¿Õ°×¸ô¿ªµÄʹÓÃÕßÃû³Æ¡£ÀýÈç:
mygroup: bob joe anne
×¢ÒâËÑÑ°ºÜ´óµÄȺ×éÎļþÊǺÜûÓÐЧÂʵģ»Ó¦¸ÃÓà AuthDBMGroupFile
À´È¡´úËü¡£
°²È«: È·¶¨Õâ¸ö AuthGroupFile ´¢·ÅÔÚ·þÎñÆ÷µÄÎļþÊ÷Ö®Í⣻²»Òª°Ñ
Ëü·ÅÔÚËü±£»¤µÄĿ¼Àï¡£·ñÔò£¬¿Í»§¶Ë½«Äܹ»ÏÂÔØÕâ¸ö AuthGrpupFile
Îļþ¡£
²ÎÔÄ AuthName, AuthType ÒÔ¼° AuthUserFile ¡£
4.4.2 AuthUserFile
Óï·¨: AuthUserFile ÎļþÃû³Æ
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: »ù´¡
Ä£×é: mod_auth
Õâ¸ö AuthUserFile Ö¸ÁîÉ趨һ¸öÎı¾ÎļþµÄÃû³Æ£¬Õâ¸öÎı¾Îļþ°üº¬ÓÃÀ´
Ö´ÐÐʹÓÃÕßÑéÈϵÄʹÓÃÕßÒÔ¼°ÃÜÂëÁÐ±í¡£ÎļþÃû³ÆÊǵ½Èº×éÎļþµÄ¾ø¶Ô
·¾¶¡£
Õâ¸öʹÓÃÕßÎļþµÄÿһÐаüÀ¨Ò»¸öʹÓÃÕßÃû³Æ£¬¸úËæÒ»¸öðºÅ£¬ÆäááÊÇ
½åÓÉ crypt() ¼ÓÃܹýµÄÃÜÂë¡£¶à¸öÏàͬʹÓÃÕßµÄÇé¿öûÓж¨Òå¡£
×¢ÒâËÑÑ°ºÜ´óµÄʹÓÃÕßÎļþÊǺÜûÓÐЧÂʵģ»Ó¦¸ÃÓà AuthDBMUserFile
À´È¡´úËü¡£
°²È«: È·¶¨Õâ¸ö AuthUserFile ´¢·ÅÔÚ·þÎñÆ÷µÄÎļþÊ÷Ö®Í⣻²»Òª°ÑËü
·ÅÔÚËüËù±£»¤µÄĿ¼Àï¡£·ñÔò£¬¿Í»§¶Ë½«Äܹ»ÏÂÔØÕâ¸ö AuthUserFile
Îļþ¡£
²ÎÔÄ AuthName, AuthType ÒÔ¼° AuthGroupFile ¡£
4.5 mod_cgi Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_cgi.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£ËüÌṩ
CGI Ö¸Áî¸åµÄÖ´ÐÐÄÜÁ¦¡£ÈκΠmime ÐÍ̬Ϊ application/x-httpd-cgi
µÄÎļþ¶¼½«ÓÉÕâ¸öÄ£×é´¦Àí¡£
4.5.1 ÕªÒª
ÈκÎÓµÓÐ application/x-httpd-cgi Ö® mime ÐÍ̬µÄÎļþ¶¼»á±»µ±×÷
CGI Ö¸Áî¸å£¬¶øÇÒÓÉ·þÎñÆ÷Ö´ÐУ¬²¢°ÑÊä³ö´«»Ø¿Í»§¶Ë¡£Îļþ¿ÉÒÔ½åÓÉ
ʹÓà AddType Ö¸ÁîËù¶¨ÒåµÄ¸±ÎļþÃû£¬»òÊǽåÓÉ·ÅÔÚ ScriptAlias Ëù
É趨µÄĿ¼À´³ÉΪÕâÖÖÐÍ̬¡£
µ±·þÎñÆ÷Æô¶¯Ò»¸ö CGI Ö¸Áî¸åʱ£¬Ëü½«¼ÓÉÏÒ»¸ö³ÆΪ DOCUMENT_ROOT
µÄ»·¾³²ÎÊý¡£Õâ¸ö²ÎÊý½«»á°üº¬ DocumentRoot ÅäÖõÄÄÚÈÝ¡£
4.5.2 CGI »·¾³²ÎÊý
Õâ¸ö·þÎñÆ÷½«»áÉèÁ¢¶¨ÒåÔÚ CGI ¹æ¸ñÖÐµÄ CGI »·¾³²ÎÊý£¬ÅäºÏÏÂÁÐ
µÄµ«Êé:
REMOTE_HOST
ÕâÖ»ÓÐÔÚ·þÎñÆ÷ûÓÐÅäºÏ MINIMAL_DNS ±àÒëµÄʱºò²Å»áÉ趨¡£
REMOTE_IDENT
ÕâÖ»ÓÐÔÚ IdentityCheck ÉèΪ on µÄʱºò²Å»áÉ趨¡£
REMOTE_USER
ÕâÖ»ÓÐÔÚ CGI Ö¸Áî¸åÐèÒªÑéÈϵÄʱºò²Å»áÉ趨¡£
4.6 mod_dir Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_dir.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£ËüÌṩ
×÷ΪĿ¼Ë÷ÒýÖ®Óá£
4.6.1 ÕªÒª
Õâ¸öÄ£×é¿ØÖÆĿ¼Ë÷Òý¡£Ä¿Â¼µÄË÷Òý¿ÉÒÔÓÐÁ½ÖÖÀ´Ô´:
¡£Ò»¸öÓÉʹÓÃÕßËù׫дµÄÎļþ£¬µäÐÍÊdzÆΪ index.html µÄÎļþ
¡£DrectoryIndex Ö¸ÁîÉ趨Õâ¸öÎļþµÄÃû³Æ¡£
¡£ÁíÒ»ÖÖÊÇÓÉ·þÎñÆ÷Ëù²úÉúµÄÁÐ±í¡£ÆäËüµÄÖ¸Áî¿ØÖÆÕâ¸öÁбíµÄ
¸ñʽ¡£AddIcon, AddIconByEncoding and AddIconByType ¶¼
ÊÇÓÃÀ´É趨ÏÔʾ²»Í¬ÎļþÐÍ̬ËùʹÓõÄͼʾÁÐ±í£»¶Ôì¶Ã¿ÖÖÁÐ
³öµÄÎļþÐÍ̬£¬ÏÔʾÁгöµÄµÚÒ»¸ö·ûºÏµÄͼʾ¡£
4.6.2 AddDescription
Óï·¨: AddDescription ×Ö´® Îļþ Îļþ ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
ÕâÊÇÉ趨ijÎļþËùÒªÏÔʾµÄÃèÊö£¬¹©ÏóáçË÷Òý(FancyIndexing) ʹÓá£
ÎļþÊÇÖ¸ËùÒªÃèÊöÖ®ÎļþµÄ¸±ÎļþÃû£¬²¿·ÝÎļþÃû³Æ£¬Ìæ´ú×ÖÔª±íʾʽ»ò
ÍêÕûÎļþÃû³Æ¡£ ×Ö´®ÒÔË«ÒýºÅ(") À¨Æð¡£ÀýÈç:
AddDescription "The planet Mars" /web/pics/mars.gif
4.6.3 AddIcon
Óï·¨: AddIcon ͼʾ Ãû³Æ Ãû³Æ ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
ÕâÉ趨ÏÔʾÔÚÎļþÃû³ÆÖ®ááµÄͼʾ¹©×÷ÏóáçË÷ÒýÖ®Óá£Í¼Ê¾¿ÉÒÔÊÇij¸ö
ͼʾµÄÏà¶Ô URL »òÊǸø·ÇͼÐλ¯ä¯ÀÀÆ÷ʹÓõÄÎÄ×Ö±êÇ©¡£
¶Ôì¶Ä¿Â¼¿ÉÒÔʹÓà ^^DIRECTORY^^ Õâ¸öÃû³Æ£¬^^BLANKICON^^ ¿ÉÒÔÓÃ
ÔÚ¿Õ°×ÐУ¨Ê¹ÁбíµÄ¸ñʽÕýÈ·£©£¬Ãû³ÆÒ²¿ÉÒÔÊÇÀ©³äÎļþÃû£¬Ìæ´ú×ÖÔª±í
ʾʽ£¬²¿·Ý»òÍêÕûµÄÎļþÃû³Æ¡£ÀýÈç:
AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm
AddIcon /icons/dir.xbm ^^DIRECTORY^^
AddIcon /icons/backup.xbm *~
¿ÉÄܵĻ°£¬Ê¹Óà AddIconByType Ó¦¸Ã±È AddIcon ºÃ¡£
4.6.4 AddIconByEncoding
Óï·¨: AddIconByEncoding icon mime-encoding mime-encoding ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
ÕâÉ趨ÏÔʾÔÚÓÐ mime-encoding µÄÎļþÃû³ÆÖ®ááµÄͼʾ¹©×÷ÏóáçË÷Òý
Ö®Óá£Í¼Ê¾¿ÉÒÔÊÇij¸öͼʾµÄÏà¶Ô URL »òÊǸø·ÇͼÐλ¯ä¯ÀÀÆ÷ʹÓõÄ
ÎÄ×Ö±êÇ©¡£
Mime-encoding ÊǸö·ûºÏÒªÇóÖ®±àÂëÄÚÈݵÄÌæ´ú×ÖÔª±íʾʽ¡£ÀýÈç:
AddIconByEncoding /icons/compress.xxbm x-compress
4.6.5 AddIconByType
Óï·¨: AddIconByType icon mime-type mime-type ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
ÕâÉ趨ÏÔʾÔÚ mime-type µÄÎļþÃû³ÆÖ®ááµÄͼʾ¹©×÷ÏóáçË÷ÒýÖ®Óá£
ͼʾ¿ÉÒÔÊÇij¸öͼʾµÄÏà¶Ô URL »òÊǸø·ÇͼÐλ¯ä¯ÀÀÆ÷ʹÓõÄÎÄ×Ö±ê
Ç©¡£
Mime-encoding ÊǸö·ûºÏÒªÇóÖ® mime ÐÍ̬µÄÌæ´ú×ÖÔª±íʾʽ¡£ÀýÈç:
AddIconByType (IMG, /icons/image.xbm) image/*
4.6.6 DefaultIcon
Óï·¨: DefaultIcon url
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
DefaultIcon Õâ¸öÖ¸ÁîÉ趨µ±²»ÖªµÀÖ¸¶¨µÄͼʾΪºÎʱÏÔʾµÄͼʾ¹©×÷
ÏóáçË÷ÒýÖ®Óá£URl ÊǸÃͼʾµÄ(%-escaped) Ïà¶Ô URL ¡£ÀýÈç:
DefaultIcon /icon/unknow.xbm
4.6.7 DirectoryIndex
Óï·¨: DirectoryIndex local-url local-url
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
DirectoryIndex Õâ¸öÖ¸ÁîÉ趨µ±¿Í»§¶Ë½åÓÉÖ¸¶¨Ã»ÓÐÒÔÎļþ×ö½áβµÄ
Ŀ¼Ãû³ÆÇëÇó¸ÃĿ¼µÄË÷ÒýʱËùÒªÕÒÑ°µÄÀ´Ô´ÁÐ±í¡£Local-url ÊÇÔÚËÅ
·þÆ÷ÉÏÏà¶Ôì¶ÇëÇó֮Ŀ¼µÄÎļþ£»Ëüͨ³£ÊÇĿ¼Àïij¸öÎļþµÄÃû³Æ¡£¿É
ÒÔÓкü¸¸ö URL £»·þÎñÆ÷»á»Ø´«ËüÕÒµ½µÄµÚÒ»¸ö¡£Èç¹ûÕâЩÀ´Ô´Ã»ÓÐ
Ò»¸ö´æÔÚ£¬ÄÇ÷á·þÎñÆ÷½«»á×ÔÐвúÉúÒ»·Ý¸ÃĿ¼µÄÁÐ±í¡£ÀýÈ磺
DirectoryIndex index.html
È»áᣬ¶Ôì¶ http://myserver/docs/ µÄÇëÇóÈô¸ÃÀ´Ô´É趨µÄÎļþ´æÔÚ
µÄ»°»á»Ø´« http://myserver/docs/index.html£¬Èç¹û²»´æÔھͻش«¸Ã
Ŀ¼µÄÁÐ±í¡£
×¢Òâ¸ÃÎļþ²¢²»ÐèÒªÊÇÏà¶Ô춸ÃĿ¼µÄ:
DirectoryIndex index.html index.txt /cgi-bin/index.pl
Õâ»áʹµÃ /cgi-bin/index.pl Õâ¸ö CGI Ö¸Áî¸åÔÚ index.html ÒÔ¼°
index.txt ¶¼²»´æÔÚ춸ÃĿ¼µÄÇé¿öϱ»Æ𶯡£
4.6.8 FancyIndexing
Óï·¨: FancyIndexing ²¼ÁÖÖµ
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
FancyIndexing ´ËÖ¸ÁîÉ趨Ŀ¼µÄÏóáçË÷ÒýÑ¡Ïî¡£²¼ÁÖÖµ¿ÉÒÔÊÇ on »ò
off¡£IndexOptions Õâ¸öÖ¸ÁîÓ¦¸ÃÓÃÀ´²ÎÕÕÖ®¡£
4.6.9 HeaderName
Óï·¨: HeaderName ÎļþÃû³Æ
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
HeaderName Õâ¸öÖ¸ÁîÉ趨²åÈëË÷ÒýÁÐʾ¶¥²¿µÄÎļþÃû³Æ¡£µ±°¸Ãû³ÆÊÇ
Òªº¬ÈëµÄÎļþÖªÃû³Æ£¬¶øÇÒÏà¶Ôì¶Ë÷ÒýµÄĿ¼¡£·þÎñÆ÷Ê×ÏÈ»á°ÑËûµ±×÷
ÊÇ HTML ÎļþÊÔͼº¬ÈëÎļþÃû³Æ.html £¬·ñÔò¾Íµ±ËüÊÇÆÕͨÎı¾Îļþº¬Èë
¡£ÀýÈç:
HeaderName HEADER
µ±²úÉú /web Ŀ¼µÄË÷Òýʱ£¬·þÎñÆ÷Ê×ÏȽ«»áÕÒÑ° /web/HEADER.html
Õâ¸ö HTML Îļþ£¬ÈôÕÒµ½Ôò½«Æ京È룬·ñÔò»áº¬Èë /web/HEADER Õâ¸ö
ÆÕͨÎı¾Îļþ£¬Èç¹û´æÔڵĻ°¡£
²ÎÔÄ ReadmeName ¡£
4.6.10 IndexIgnore
Óï·¨: IndexIgnore Îļþ Îļþ ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
IndexIgnore Õâ¸öÖ¸Áî°ÑÁгöĿ¼ʱҪÒþ²ØµÄÎļþ¼Óµ½ÁбíÖС£Îļþ
ÊÇÖ¸ËùÒªºöÂÔÖ®ÎļþµÄ¸±ÎļþÃû£¬²¿·ÝÎļþÃû³Æ£¬Ìæ´ú×ÖÔª±íʾʽ»òÊÇ
ÍêÕûÎļþÃû³Æ¡£¶à¸ö IndexIgnore Ö¸Áî»á°ÑÎļþ¼ÌÐø¼ÓÈëÁбíÖжø
²»»áÈ¡´úÇ°ÃæµÄÉ趨µÄºöÂÔÎļþÁÐ±í¡£ÒÀÔ¤É裬´ËÁбí°üº¬ `.' ¡£
ÀýÈç:
IndexIgnore README .htaccess *~
4.6.11 IndexOptions
Óï·¨: IndexOptions Ñ¡Ïî Ñ¡Ïî ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
IndexOptions Õâ¸öÖ¸ÁîÖ¸¶¨½øÐÐĿ¼Ë÷ÒýʱµÄ¶¯×÷¡£Ñ¡Ïî¿ÉÒÔÊÇÏÂÁÐ
ÆäÖÐÖ®Ò»
FancyIndexing
Õâ´ò¸ÃĿ¼µÄÏóáçË÷Òý¡£
IconsAreLinks
Õâʹͼʾ³ÉΪÎļþÁ´½áµÄÒ»²¿·ÝÒÔ×÷ΪÏóáçË÷ÒýÖ®Óá£
ScanHTMLTitles
Õâ´ò¿ªß¢È¡ HTML ÎļþµÄ±êÌâÒÔ×÷ΪÏóáçË÷ÒýʹÓõŦÄÜ¡£Èç¹û
¸ÃÎļþ²¢Ã»ÓнåÓÉ AddDescription Ëù¸øµÄÃèÊöÄÇ÷á httpd ½«
»áΪÁËÈ¡µÃ´ËÖµ¶ø¶ÁÈ¡ÎļþµÄ TITLE ±êÇ©¡£Õâ»á¼ÓÖØ CPU ¼°
´ÅµúµÄ¸ºµ£¡£
SuppressModified
Õ⽫»áÒþÂ÷ÏóáçË÷ÒýÁÐʾÖеÄ×îááÐÞ¸ÄÈÕÆÚ¡£
SuppressSize
Õ⽫»áÒþÂ÷ÏóáçË÷ÒýÁÐʾÖеÄÎļþ´óС¡£
SuppressDescription
Õ⽫»áÒþÂ÷ÏóáçË÷ÒýÁÐʾÖеÄÎļþÃûÊý¡£
Ô¤ÉèÊÇûÓдò¿ªÈκÎÒ»¸öÑ¡Ïî¡£Èç¹ûÓжà¸ö IndexOptions ¿ÉÒÔÓ¦Óõ½
Ò»¸öĿ¼ÉÏ£¬ÄÇ÷á×îÃ÷°×µÄÄǸö»á±»ÍêÈ«²ÉÓã»Ñ¡Ïî²»»áºÏ²¢¡£ÀýÈç:
<Directory /web/docs>
IndexOptions FancyIndexing
</Directory>
<Directory /web/docs/spec>
IndexOptions ScanHTMLTitles
</Directory>
ÄÇ÷á /web/doc/spec Ŀ¼½«Ö»ÉèΪ ScanHTMLTitles ¡£
4.6.12 ReadmeName
Óï·¨: ReadmeName ÎļþÃû³Æ ...
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Indexes
״̬: »ù´¡
Ä£×é: mod_dir
ReadmeName Õâ¸öÖ¸ÁîÒª¸½¼Óµ½Ë÷ÒýÁÐʾááÃæµÄÎļþÖ®Ãû³Æ¡£ÎļþÃû³Æ
ÊÇÖ¸Òªº¬ÈëµÄÎļþ£¬¶øÇÒÊÇÏà¶Ôì¶Ë÷ÒýµÄĿ¼¡£·þÎñÆ÷Ê×ÏÈ»á°ÑËûµ±×÷
ÊÇ HTML ÎļþÊÔͼº¬ÈëÎļþÃû³Æ.html £¬·ñÔò¾Íµ±ËüÊÇÆÕͨÎı¾Îļþº¬Èë
¡£ÀýÈç:
ReadmeName README
µ±²úÉú /web Ŀ¼µÄË÷Òýʱ£¬·þÎñÆ÷Ê×ÏȽ«»áÕÒÑ° /web/README.html
Õâ¸ö HTML Îļþ£¬ÈôÕÒµ½Ôò½«Æ京È룬·ñÔò»áº¬Èë /web/README Õâ¸ö
ÆÕͨÎı¾Îļþ£¬Èç¹û´æÔڵĻ°¡£
²ÎÔÄ HeaderName ¡£
4.7 mod_imap Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_imap.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£ËüÊÇΪ
´¦Àí .map Îļþ¶øÌṩµÄ£¬ÓÃÀ´´úÌæ imagemap Õâ¸ö CGI ³ÌÐòµÄ¹¦ÄÜ
¡£Èκκ¬ÓÐ mime ÐÍ̬Ϊ application/x-httpd-imap Ö®×ÊÁϵÄÎļþ¶¼
½«ÓÉÕâ¸öÄ£×é´¦Àí¡£
4.7.1 ÕªÒª
ΪÁËʹÓ÷þÎñ¶ËÆÊÎö(server-parsed) µÄÓ°ÏñµØͼ(imagemap)µµ£¬ÄãÊ×
ÏȱØÐë°ÑÕâ¸öÄ£×é±àÒëµ½·þÎñÆ÷ÀïÈ¥£¬²¢ÇÒÔÚ·þÎñÆ÷ÅäÖõµÖмÓÈëÏÂÁÐ
ÕâÒ»ÐС£Õâ¸öÏîÄ¿Ö¸³öÓ°ÏñµØͼµµ½«»áÒÔ .map ¸±ÎļþÃûÃüÃû¡£
AddType application/x-httpd-imap map
4.7.2 ÐÂÌØÉ«
imagemap Õâ¸öÄ£×é¼ÓÈëÁËһЩÏÈÇ°·¢ÐÐµÄ iamgemap ³ÌÐò°æ±¾²»¿ÉÄÜ
´ï³ÉµÄÐÂÌØÉ«¡£
¡£URL ²ÎÕÕÏà¶Ôì¶ Referer: µÄ×ÊѶ
¡£¾ÓÉÐ嵀 base_uri À¸Î»Ö¸¶¨Ô¤ÉèµÄ <BASE>
¡£²»ÐèÒª imagemap.conf Îļþ
¡£Point ²ÎÕÕ
base_uri Ñ¡Ïî:
map
ÌṩԤÉè¼°¾ÉʽµÄ map ¹ØÁ¬²Î¿¼Ö®¹¦ÄÜ¡£
refer
ʹÓà Referer: ±êÍ·×ÊѶ²ÎÕÕÏà¶ÔÄ¿Ç°ÎļþµÄ URL ¡£
http://whateverurl
É趨 URL µÄ <BASE> É趨ʹËùÓеIJÎÕÕ¶¼Ïà¶Ôì¶ <BASE> ¡£
µØͼµµ¡õÀý
default http:/lincoln/
base_uri referer
rect .. 0,0 77,27
poly http://www.inetnebr.com/ 78,0 194,27
circle http://www.inetnebr.com/loncoln/feedback/ 195,0 305,27
rect search_index 306,0 419,27
point http://www.zyzzyva.com/ 420,0 549,27
²ÎÕÕÄãµÄµØͼµµ
<A HREF:"http://maps/imagemap1.map">
<IMG ISMAP SRC="http:/images/imagemap1.gif">
</A>
4.8 mod_include Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_include.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£Ëü
Ìṩ¸ø·þÎñ¶ËÆÊÎöµÄ html ÎļþÓ㬼´ËùÖªµÄ SPML Îļþ¡£Èκκ¬mime
ÐÍ̬ text/x-server-parsed-html »ò text/x-server-parsed-html3
µÄÎļþ½«»áÓÉÕâ¸öÄ£×éÆÊÎö£¬Êä³öÖ®½á¹ûµÄ mime ÐÍ̬ÊÇ text/html¡£
4.8.1 SPML £ °üº¬Îļþ¸ñʽ
ÕâÖÖÎļþ±»µ±×÷ HTML ÎļþÆÊÎö£¬²¢Èçͬ SGML µÄ×¢½âǶÈë(embedded)
ÌØÊâµÄÖ¸Áî¡£Ö¸ÁîÒ»°ãµÄÓï·¨ÊÇ:
<!--# ÏîÄ¿ÊôÐÔ=Öµ ÊôÐÔ=Öµ ...-->
ÕâÀïµÄÖµ³£°üÀ¨ÔÚË«ÒýºÅÀÐí¶àÖ¸ÁîÖ»ÔÊÐíµ¥Ò»¸öÊôÐÔ£ÖµµÄÅä¶Ô¡£
ÔÊÐíʹÓõÄÏîÄ¿ÊÇ:
config
Õâ¸öÖ¸Áî¿ØÖƸ÷ÖÖÆÊÎöµÄ·½Ê½¡£ÓÐЧµÄÊôÐÔÊÇ:
errmsg
´ËÖµÊÇÈç¹ûÆÊÎöÎļþ·¢Éú´íÎóʱËͻؿͻ§¶ËµÄѶϢ¡£
sizefmt
´ËÖµÊÇÉ趨ÏÔʾÎļþ´óСʹÓõĸñʽ¡£ÓÐЧµÄÖµÊÇʹÓÃ
λԪ×é¼ÆËãµÄ bytes »òÊÇÒÔ Kb »ò Mb ÖкÏÊÊÕßÏÔʾ
µÄ abbrev ¡£
timefmt
´ËÖµÊÇÁÐÓ¡ÈÕÆÚʱÓÉ strftime(3) ³ÌÐò¿âº¯Ê½Ê¹ÓõÄ
×Ö´®¡£
echo
Õâ¸öÖ¸ÁîÁÐÓ¡ÄÚºµÄ²ÎÊýÆäÖÐÖ®Ò»£¬¶¨ÒåÈçÏ¡£Èç¹û¸Ã²ÎÊýδ±»
É趨ÔòÓ¡³ö(none)¡£Ó¡³öµÄÈκÎÈÕÆÚ¶¼ÒÀ´ÓÄ¿Ç°ÅäÖÃµÄ timefmt
¡£ÊôÐÔ:
var
´ËÖµÊÇÒªÓ¡³öÖ®²ÎÊýµÄÃû³Æ¡£
exec
´ËÖ¸ÁîÖ´ÐÐËù¸ø shell Ö¸Áî»ò CGI Ö¸Áî¸å¡£InculdesNOEXEC
Õâ¸öÑ¡Ïî¿ÉÒÔÍêÈ«¹Ø±ÕÕâ¸öÖ¸Áî¡£ÓÐЧµÄÊôÐÔÊÇ:
cgi
´ËÖµÖ¸¶¨ (%-encode)URL µ½ CGI Ö¸Áî¸åµÄÏà¶Ô·¾¶
¡£Èç¹û¸Ã·¾¶Ã»ÓÐÒÔ(/) ×÷Ϊ¿ªÊ¼£¬ÄÇ÷áËü¾ÍÊÇÏà¶Ôì¶
Ä¿Ç°µÄÎļþ¡£Õâ¸ö·¾¶Ëù²ÎÕÕµÄÎļþ»á±»µ±×÷ÊǸö CGI
Ö¸Áî¸åÆ𶯣¬¼´Ê¹·þÎñÆ÷²¢²»ÈÏΪËüÊǸö CGI Ö¸Áî¸å
¡£È»¶ø£¬°üº¬¸ÃÖ¸Áî¸åµÄĿ¼±ØÐë´ò¿ª CGI Ö¸Áî¸åµÄ
Ö§Ô®£¨ÒÔ ScriptAlias »ò ExecCGI Ñ¡Ïî´ò¿ª£©¡£
´Ó¿Í»§¶ËÀ´µÄÇëÇó¸øÓè´ËÖ¸Áî¸å PATH_INFO ÒÔ¼°²éѯ
×Ö´®(QUERY_STRING)£»µ«ÕâÎÞ·¨ÔÚ URL ·¾¶ÖÐÖ¸¶¨¡£
ËùÒÔÔÚ±ê×¼µÄ CGI »·¾³²ÎÊýÖ®ÍâÖ¸Áî¸å¿ÉÒÔ´ÓÄÚº¬µÄ
²ÎÊýÈ¡µÃÕâЩ×ÊѶ¡£
Èç¹û¸ÃÖ¸Áî¸å»Ø´« Location: ±êÍ·¶ø²»ÊÇÒ»°ãµÄÊä³ö
£¬ÄÇ÷áÕ⽫»á±»×ª»»³É HTML µÄÁ´½á¡£
include virtual Õâ¸öÏîÄ¿Ó¦¸ÃÓÃÀ´²ÎÕÕ exec cgi ¡£
cmd
·þÎñÆ÷½«»áÒÔ /bin/sh Ö´ÐÐËù¸øµÄ×Ö´®¡£Õâ¸öÖ¸Áî¿É
ÒÔÈ¡µÃÄÚº¬µÄ²ÎÊý¡£
fsize
Õâ¸öÖ¸ÁîÓ¡³öÖ¸¶¨ÎļþµÄ´óС£¬²¢ÒÀ´Ó sizefmt µÄ¸ñʽָ¶¨¡£
ÊôÐÔ:
file
´ËÖµÊÇ°üº¬ÒªÆÊÎöÖ®ÎļþµÄĿ¼֮Ïà¶Ô·¾¶¡£
virtual
´ËÖµÊÇÏà¶Ôì¶ÒªÆÊÎöÖ®ÎļþµÄ (%-encoded) URL ·¾¶
¡£Èç¹û¸Ã·¾¶Ã»ÓÐÒÔ(/) ×÷Ϊ¿ªÊ¼£¬ÄÇ÷áËü¾ÍÊÇÏà¶Ôì¶
Ä¿Ç°µÄÎļþ¡£
flastmod
Õâ¸öÖ¸ÁîÓ¡³öÖ¸¶¨Îļþ×îááÐ޸ĵÄÈÕÆÚ£¬ÒÀ´Ó timefmt µÄ¸ñʽ
Ö¸¶¨¡£ÊôÐÔÓë fsize Ö¸ÁîµÄÊôÐÔÒ»Ñù¡£
include
Õâ¸öÖ¸Áî²åÈëÁíÒ»·ÝÎļþ»òÎļþµÄÄÚÈݵ½ÒªÆÊÎöµÄÎļþÀï¡£ÈκÎ
º¬ÈëµÄÎļþ¶¼ÒÀ´Óͨ³£µÄ´æÈ¡¿ØÖÆ¡£Èç¹û°üº¬ÆÊÎöÎļþµÄĿ¼Éè
ÓÐ IncludesNOEXEC Ñ¡Ï¶øÇÒº¬Èë¸ÃÎļþ»áÆð¶¯Ä³Ö§³ÌÐòµÄ»°
£¬ÄÇ÷áËü½«²»»á±»º¬È룻Õâ×èÖ¹ CGI Ö¸Áî¸åµÄÖ´ÐС£·ñÔò CGI
Ö¸Áî¸å¾Í»áÈçͬһ°ãÔÚÖ¸ÁîÖÐʹÓÃÍêÕûµÄ URL Ö¸¶¨µÄÒ»ÑùÖ´ÐÐ
£¬°üº¬Èκβéѯ×Ö´®¡£
ÓиöÊôÐÔ¶¨ÒåÎļþµÄλÖÃ:
file
´ËÖµÊÇ°üº¬Ä¿Ç°ÒªÆÊÎöÖ®ÎļþµÄĿ¼֮Ïà¶Ô·¾¶¡£Ëü²»
ÄÜ°üº¬ÓÐ ../ Ò²²»ÄÜÊǾø¶Ô·¾¶¡£virtual Õâ¸öÊôÐÔ
ÓÀÔ¶Ó¦¸ÃÓÃÀ´²ÎÕÕÕâÒ»¸ö¡£
virtual
´ËÖµÊÇÏà¶Ôì¶Ä¿Ç°ÒªÆÊÎöÖ®ÎļþµÄ (%-encoded)URL ¡£
´Ë URL ²»ÄÜ°üº¬Óж¯×÷(scheme)»òÖ÷»úÃû³Æ£¬Ö»ÄÜÊÇ
·¾¶»òÑ¡ÓõIJéѯ×Ö´®¡£Èç¹ûËü²»ÊÇÒÔµ¹Ð±Ïß(/) ×÷Ϊ
¿ªÊ¼ÄÇ÷áËü¾ÍÊÇÏà¶Ôì¶Ä¿Ç°µÄÎļþ¡£
URL ÊÇÓÉÊôÐÔ½¨¹¹µÄ£¬Èç¹û¿Í»§¶ËÇëÇóµÄ URL °üº¬ÔÚ±»ÆÊÎöµÄ
Êä³öÔò·þÎñÆ÷»á»Ø´«¸ÃÊä³ö¡£Òò´Ëº¬ÈëµÄÎļþ¿ÉÒÔÊdz²×´µÄ¡£
4.8.2 ÄÚº¬µÄ²ÎÊý
ÕâЩ²ÎÊý¿ÉÒÔÌṩ¸ø echo Ö¸ÁÒÔ¼°ÈκÎÓÉÎļþÆ𶯵ijÌÐòÈ¡Óá£
DATE_GMT
Ä¿Ç°µÄ¸ñÁÖÍþÖÎÈÕÆÚ¡£
DATE_LOCAL
Ä¿Ç°µ±µØʱ¼äÇøÓòµÄÈÕÆÚ¡£
DOCUMENT_NAME
ʹÓÃÕßÇëÇóÖ®ÎļþµÄÎļþÃû³Æ£¨²»°üÀ¨Ä¿Â¼£©¡£
DOCUMENT_URI
ʹÓÃÕßÇëÇóÖ®ÎļþµÄ (%-decoded)URL ·¾¶¡£×¢Ò⣬ÔÚ³²×´º¬Èë
ÎļþÕâÖÖÇé¿öÏ£¬Õâ²»»áÊÇÄ¿Ç°ÎļþµÄ URL ¡£
LAST_MODIFIED
ʹÓÃÕßÒªÇóÖ®Îļþ×îááÐ޸ĵÄÈÕÆÚ¡£
4.8.3 XBitHack
Óï·¨: XBitHack ״̬
Óï·¨
Ô¤Éè: XBitHack off
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: Options
״̬: »ù´¡
Ä£×é: mod_include
XBitHack Õâ¸öÖ¸Áî¿ØÖÆÒ»°ã html ÎļþµÄÆÊÎö¡£×´Ì¬¿ÉÒÔÊÇÏÂÁÐÖµ:
off
¶Ô¿ÉÖ´ÐеÄÎļþÒ»ÊÓͬÈÊ¡£
on
ÈκÎÉèÓдú±íʹÓÃÕß¿ÉÖ´ÐÐ֮λԪµÄÎļþ½«±»µ±×÷ÊÇ·þÎñ¶ËÆÊÎö
µÄ html Îļþ¡£
full
Óë on Ïàͬµ«Í¬Ê±»¹²âÊÔ´ú±íȺ×é¿ÉÖ´ÐÐ֮λԪ¡£Èç¹ûÓÐÉ趨£¬
ÄÇ÷á²»»áËͳö×îááÐÞ¸ÄÈÕÆÚ¡£É趨Õâ¸öλԪʹ¿Í»§¶ËÒÔ¼°´úÀíÕß
(proxies) ¿ÉÒÔÔÝ´æÇëÇóµÄ½á¹û¡£
4.9 mod_log_common Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_log_common.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£
ËüÌṩʹÓÃÒ»°ã¼Ç¼µµ¸ñʽ(Common Logfile Format) ¼Ç¼¶Ô·þÎñÆ÷Ö®
ÇëÇóµÄ¹¦ÄÜ¡£
4.9.1 ¼Ç¼µµ¸ñʽ
¶Ôì¶Ã¿¸öÇëÇó¼Ç¼µµ°üº¬¸ö±ðµÄÒ»ÐС£Ò»ÐÐÊÇÓÉÊý¸öÒÔ¿Õ°×¼ä¸ôµÄ¼Ç
ºÅËù×é³É:
host ident authuser date request status bytes
Èç¹ûij¸ö¼ÇºÅûÓÐÖµ¾Í»áÒÔ¶ÌÏß(-) ±íʾ¡£ÕâЩ¼ÇºÅÒÔ¼°Æä´ú±íµÄÒâÒå
ÈçÏÂ:
host
¿Í»§¶ËµÄÍêÕûÓòÃû£¬»òÕßÈç¹ûÎÞ·¨È¡µÃÆäÃû³ÆµÄ»°
Ôò¼Ç¼ IP λַ
ident
Èç¹û¿ªÆô IdentityCheck ¹¦ÄܶøÇÒ¿Í»§¶Ë»úÆ÷Ö´ÐÐÓÐ
identd µÄ»°£¬ÄÇ÷áÕâ»áÊÇ¿Í»§¶ËËù±¨¸æµÄ identity
×ÊѶ¡£
authuser
Èç¹ûÇëÇóµÄÊÇÃÜÂë±£»¤µÄÎļþ£¬ÄÇ÷áÕâ»áÊÇÇëÇóÖÐʹÓÃ
µÄʹÓÃÕßʶ±ðÂë¡£
date
ÇëÇóµÄÈÕÆÚÒÔ¼°Ê±¼ä£¬Ê¹ÓÃÏÂÁеĸñʽ:
date = [day/month/year:hour:minute:second
zone]
day = 2*Êý×Ö
month = 3*×ÖÔª
year = 4*Êý×Ö
hour = 2*Êý×Ö
minute = 2*Êý×Ö
second = 2*Êý×Ö
zone = ('+' | '-') 4*Êý×Ö
request
´Ó¿Í»§¶Ë´«À´µÄÇëÇóÐУ¬ÒÔË«ÒýºÅ(") À¨Æð¡£
status
»Ø´«¸ø¿Í»§¶Ë£¬ÈýλÊý×ÖµÄ״̬Âë¡£
bytes
»Ø´«¸ø¿Í»§¶ËµÄλԪ×éÊýÁ¿£¬±¨°üº¬ÈκαêÍ·¡£
4.9.2 TransferLog
Óï·¨: TransfetLog Îļþ£¹ÜÏß
Ô¤Éè: TransferLog logs/transfer_log
ÓÃì¶: server config, virtual host
״̬: »ù´¡
Ä£×é: mod_log_common
TransferLog Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷¼Ç¼½øÈëÖ®ÇëÇóµÄÎļþÃû³Æ¡£Îļþ£
¹ÜÏßÊÇÕâЩÆäÖÐÖ®Ò»:
Ò»¸öÎļþÃû³Æ
Ò»¸öÏà¶Ôì¶ ServerRoot µÄÎļþÃû³Æ
`|' ¸úËæÖøÒ»¸öÖ¸Áî
´Ó±ê×¼ÊäÈë½ÓÊղο¼¼Ç¼×ÊѶµÄ³ÌÐò¡£×¢ÒâÈç¹ûÐéÄâÖ÷»ú´ÓÖ÷Òª
·þÎñÆ÷¼Ì³Ð RefererLog É趨µÄ»°²»»áÆð¶¯ÐµijÌÐò¡£
°²È«: Èç¹ûÔÚ´ËʹÓóÌÐò£¬Ëü½«»áÒÔÆ𶯠httpd µÄʹÓÃÕßÉí·ÖÖ´ÐС£
Èç¹û·þÎñÆ÷ÓÉ root Æð¶¯ÄÇ÷á´Ë³ÌÐò¾ÍÊÇÓÉ root Ö´ÐУ»ËùÒÔҪȷ¶¨´Î
³ÌÐòµÄ°²È«ÐÔ¡£
4.10 mod_mime Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_mime.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£ËûÌṩ
´ÓÎļþÃû³Æ¾ö¶¨ÎļþÐÍ̬µÄ¹¦ÄÜ¡£
4.10.1 ÕªÒª
Õâ¸öÄ£×éÓÃÀ´¾ö¶¨ÎļþµÄ mime ÐÍ̬¡£Ä³Ð© mime ÐÍ̬»áÖ¸³ö·þÎñÆ÷µÃ
Ö´ÐеÄÌرð³ÌÐò£¬ÆäËüµÄÐÍ̬Ôò´«»Ø¿Í»§¶Ë£¬Èç´Ëä¯ÀÀÆ÷¾Í¿ÉÒÔÊʵ±µØ
´¦ÀíÎļþ¡£
ÎļþµÄÎļþÃû³Æ±»µ±×÷»ù±¾Ãû³ÆµÄÒ»²¿·Ý£¬Æäáá¸úËæijЩ¸±ÎļþÃû£¬´ÎÐò
ÈçÏÂ:
base.type.language.enc
ÆäÖÐ type Õâ¸ö¸±ÎļþÃûÉ趨ÎļþµÄÐÍ̬£¬ÐÍ̬¶¨ÒåÔÚ TypesConfig Îļþ
ÒÔ¼° AddType Ö¸ÁîµÄÉ趨ÖС£¶ø language Õâ¸ö¸±ÎļþÃûÉ趨ÎļþµÄÓïÑÔ
£¬½åÓÉ AddLanguage Ö¸ÁÒå¡£×îáᣬenc Õâ¸ö¸±ÎļþÃûÉ趨ÎļþµÄ±àÂë
£¬½åÓÉ AddEncoding Ö¸ÁÒå¡£
4.10.2 AddEncoding
Óï·¨: AddEncoding mime-enc ¸±ÎļþÃû ¸±ÎļþÃû
ÓÃì¶: server config, virtual host, directory, .htacess
ÐèÇó: FileInfo
״̬: »ù´¡
Ä£×é: mod_mime
AddEncoding Õâ¸öÖ¸ÁîÒÔÖ¸¶¨µÄ±àÂëÐÍ̬°Ñ¿ÉÄÜ×÷ΪÎļþÃû³Æ½áβµÄ¸±
ÎļþÃû¼ÓÈëÎļþ¸±ÎļþÃûÁÐ±í¡£Mime-enc ÊÇÓÃÔÚÒԸø±ÎļþÃû½áβµÄÎļþµÄ
mime ±àÂë¡£ÀýÈç:
AddEncoding x-gzip gz
AddEncoding x-compress Z
Õ⽫»áʹÒÔ .gz ½áβµÄÎļþ±»±ê¼ÇΪʹÓà z-gzip ±àÂ룬ÒÔ¼° .Z ½á
βµÄÎļþ±»±ê¼ÇΪʹÓà x-compress ±àÂë¡£
4.10.3 AddLanguage
Óï·¨: AddLanguage mime-lang ¸±ÎļþÃû ¸±ÎļþÃû
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: FileInfo
״̬: »ù´¡
Ä£×é: mod_mime
AddLanguage Õâ¸öÖ¸ÁîÒÔÖ¸¶¨µÄÓïÑÔ°Ñ¿ÉÄÜ×÷ΪÎļþÃû³Æ½áβµÄ¸±ÎļþÃû
¼ÓÈëÎļþ¸±ÎļþÃûÁÐ±í¡£Mime-lang ÊÇÒԴ˸±ÎļþÃû×÷ΪÃû³Æ½áβ֮ÎļþµÄ
mime ÓïÑÔ£¬ÕâÊÇÔÚËùÓÐ×÷Ϊ±àÂëµÄ¸±ÎļþÃûÒƳýÖ®ááÔÙ¾ö¶¨µÄ¡£ÀýÈç:
AddEncoding x-compress Z
AddLanguage en .en
AddLanguage fr .fr
ÄÇ÷á xxxx.ez.Z ½«»á±»µ±×÷ѹËõ¹ýµÄÓ¢ÎÄÎļþ¡£ËäÈ»ÄÚÈݵÄÓïÑÔÒѾ
±¨¸æ¸ø¿Í»§¶Ë£¬ä¯ÀÀÆ÷²»Ì«¿ÉÄÜʹÓôË×ÊѶ¡£AddLanguage Õâ¸öÖ¸Áî¶Ô
ÄÚÈÝÐÉÌ(content negotiation) »á¸üÓÐÓã¬ÕâÑù·þÎñÆ÷¿ÉÒԲο¼¿Í»§
¶
4.10.4 AddType
Óï·¨: AddType mime-type ¸±ÎļþÃû ¸±ÎļþÃû
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: FileInfo
״̬: »ù´¡
Ä£×é: mod_mime
AddType Õâ¸öÖ¸ÁîÒÔÖ¸¶¨µÄÄÚÈÝÐÍ̬°Ñ¿ÉÄÜ×÷ΪÎļþÃû³Æ½áβµÄ¸±ÎļþÃû
¡£Mime-type ÊÇÓÃÔÚÒԸø±ÎļþÃû½áβµÄÎļþµÄ mime ÐÍ̬¡£ÕâÊÇÔÚËùÓÐ
×÷Ϊ±àÂëÒÔ¼°ÓïÑԵĸ±ÎļþÃûÒƳýÖ®ááÔÙ¾ö¶¨µÄ¡£ÀýÈç:
AddType image/gif GIF
Ð嵀 mime ÐÍ̬½¨ÒéʹÓà AddType Ö¸Áî¼ÓÈë¶ø²»ÒªÐÞ¸Ä TypesConfig
Îļþ¡£
×¢Ò⣬Óë NCSA httpd ²»Í¬£¬Õâ¸öÖ¸Áî²»ÄÜÓÃÀ´É趨ÌØÊâÎļþµÄÐÍ̬¡£
4.10.5 TypesConfig
Óï·¨: TypesConfig ÎļþÃû³Æ
Ô¤Éè: TypesConfig conf/mime.types
ÓÃì¶: server config
״̬: »ù´¡
Ä£×é: mod_mime
TypesConfig Õâ¸öÖ¸ÁîÉ趨 mime ÐÍ̬ÅäÖõµËùÔÚµÄλÖá£ÎļþÃû³ÆÊÇ
Ïà¶Ôì¶ ServerRoot µÄ¡£Õâ¸öÎļþÉ趨´ÓÎļþÀ©³äÎļþÃû¶ÔÓ¦ÄÚÈÝÐÍ̬µÄ
Ô¤ÉèÁÐ±í£»²»½¨Òé±ä¸üÕâ¸öÎļþ¡£Ê¹Óà AddType Ö¸ÁîÈ¡´ú¶ÔËü×öÐÞ¸Ä
¡£ÎļþËù°üº¬µÄÐÐÊÇʹÓà AddType Ö¸ÁîµÄ²ÎÊý¸ñʽ:
mime ÐÍ̬ ¸±ÎļþÃû ¸±ÎļþÃû ...
¸±ÎļþÃûÊÇСд£¬¿Õ°×ÐУ¬ÒÔ¼°('#') ÆðʼµÄÐлᱻºöÂÔ¡£
4.11 mod_negotiation Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_negotiation.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´
¡£ËüÊÇÌṩ×÷ΪÄÚÈÝÐÉÌÖ®Óõġ£ÈκÎÎļþÈç¹ûËüµÄ mime ÐÍ̬֮É趨
Ϊ application/x-type-map Ôò½«»áÓÉÕâ¸öÄ£×é´¦Àí¡£
4.11.1 ÕªÒª
ÄÚÈÝÐÉÌ£¬»ò¸ü¾«È·µÄ˵£¬ÄÚÈÝÑ¡Ôñ£¬ÊÇ´Ó¼¸·Ý¿ÉÒÔÈ¡ÓõÄÎļþÖÐÑ¡Ôñ
×î·ûºÏ¿Í»§¶ËÄÜÁ¦µÄÎļþ¡£ÕâÓÐÁ½ÖÖʵ×÷µÄ·½·¨¡£
¡£Ã÷È·Áгö°üº¬²îÒìÖ®ÎļþµÄÐÍ̬¶ÔÓ¦£¨Õâ¾ÍÊÇʹÓà mime ÐÍ̬
Ϊ application/x-type-map µÄÎļþ£©
¡£¶àÖع۵ãËÑÑ°£¨½åÓÉ MultiViews Ñ¡ÏÆô£©£¬´Ëʱ·þÎñÆ÷»á
Ö´ÐÐÒþº¬µÄÎļþÃû³ÆÑù°å¶ÔÕÕ£¬²¢´ÓÖÐÑ¡Ôñ½á¹û¡£
ÐÍ̬¶ÔÓ¦
ÐÍ̬¶ÔÓ¦µÄ¸ñʽÓë RFC822 Óʼþ±êÍ·Ïàͬ¡£Ëü°üº¬ÒÔ¿Õ°×Ðмä¸ôµÄÎļþ
ÃèÊö£¬ÒÔÔÓ´Õ('#') ×ÖÔª¿ªÍ·µÄÐлᱻµ±×÷×¢½â¡£ÎļþÃèÊöÓÉÊýÖÖ±êÍ·
¼Ç¼×é³É£»Èç¹ûÒÔ¿Õ°××÷ΪÁ¬ÐøÐеĿªÊ¼ÄÇ÷á¼Ç¼¿ÉÒÔÁ¬ÐøºÜ¶àÐС£Ç°
µ¼µÄ¿Õ°×»á±»É¾³ý¶øÕâЩÐоͿÉÒÔÁ¬½ÓÆðÀ´¡£±êÍ·¼Ç¼°üº¬¹Ø¼ü×ÖÃû³Æ
£¬Õâ×ÜÊÇÒÔðºÅ½á⣬¸úÖøÒ»¸öÖµ¡£Ôڹؼü×ÖÓëÖµÖ®¼ä£¬ÒÔ¼°ÖµµÄ¼ÇºÅ
Ö®¼äÔÊÐí¿Õ°×¡£¿ÉÒÔʹÓõıêÍ·ÊÇ:
Content-Encoding:
ÎļþµÄ±àÂ롣Ŀǰ½åÓÉ http Ö»ÈϵÃÁ½ÖÖ±àÂ룻 compress ѹËõ
µÄÎļþÊÇ x-compress ¶ø gzip ѹËõµÄÎļþÊÇ x-gzip ¡£
Content-Language:
²»Í¬µÄÓïÑÔ£¬Ê¹ÓÃÍø¼ÊÍø·±ê×¼ÓïÑÔÂ룬ÏñÊÇ en ¡£
Content-Length:
ÎļþµÄ³¤¶È£¬µ¥Î»ÊÇλԪ×é¡£Èç¹ûÕâ¸ö±êÍ·²»´æÔÚ£¬ÄÇ÷á¾ÍʹÓÃ
¸ÃÎļþÕæʵµÄ³¤¶È¡£
Content-Type:
ÎļþµÄ MIME ýÌåÐÍ̬£¬ÓÐÑ¡ÓõIJÎÊý¡£²ÎÊýÒÔ·ÖºÅÓëýÌåÐÍ̬
¼°ÆäËü²ÎÊý¼ä¸ô¡£²ÎÊýµÄÓï·¨ÊÇ Ãû³Æ=Öµ£»¿ÉÒÔʹÓõIJÎÊýÊÇ:
level
´ËÖµÊÇÕûÊý£¬Ö¸³öýÌåÐÍ̬°æ±¾¡£¶Ôì¶ text/html ´Ë
Ô¤ÉèΪ 2 ¶øÆäËüÔòΪ 0 ¡£
qs
´ËÖµÊǸ¡µãÊýÆäÖµÔÚ 0. ÒÔ¼° 1 Ö®¼ä¡£ËüÖ¸³ö²îÒìµÄ
¡®ÖÊ¡¯¡£
ÀýÈç:
Content-Type: image/jpeg; qs=0.8
URI:
°üº¬Õâ¸öÓÐËù²îÒìµÄÎļþÖ® URL£¬Ïà¶Ôì¶ map Îļþ¡£
¶àÖع۵ã
Öع۵ãËÑÑ°ÊÇÒÔ MultiViews Ñ¡ÏÆô¡£Èç¹û¸Ã·þÎñÆ÷½ÓÊÕµ½Ò»¸ö¶Ôì¶
/some/dir/foo µÄÇëÇó¶ø /some/dir/foo ²»´æÔڵĻ°£¬ÄÇ÷á·þÎñÆ÷»á
¶ÁȡĿ¼ÖÐËùÓÐÃûΪ foo.* µÄÎļþ£¬²¢ÇÒÓÐЧµØ¼ÙÔìÕâЩÎļþµÄÐÍ̬
¶ÔÓ¦£¬Èç¹û¿Í»§¶ËÒÔÃû³Æ²éÎÊËüÃǾÍÒÔÏàͬµÄýÌåÐÍ̬ÒÔ¼°ÄÚÈݱàÂëÀ´
Ö¸¶¨ËüÃÇ¡£È»ááÑ¡Ôñ×î·ûºÏ¿Í»§¶ËÇëÇóµÄÒ»·Ý£¬²¢Çһش«¸ÃÎļþ¡£
4.11.2 LanguagePriority
Óï·¨: LanguagePriority mime-lang mime-lang
ÓÃì¶: server config, virtual host, directory, .htaccess
ÐèÇó: FileInfo
״̬: »ù´¡
Ä£×é: mod_mime
LanguagePriority Õâ¸öÖ¸ÁîÊÇÔÚ´¦Àí¶àÖع۵ãÇëÇóʱÉ趨ÈôÓвîÒ죬
¶ø¿Í»§¶ËûÓбíʾҪ²ÎÕÕºÎÖÖÓïÑÔµÄÇé¿öϵÄÓïÑÔÓÅÏÈȨ¡£ mime-lang
ÁбíÊǵݼõµÄ˳Ðò¡£ÀýÈç:
LanguagePriority en fr de
ÇëÇó foo.html £¬¶ø foo.html.fr ÒÔ¼° foo.html.de ¶¼´æÔÚ£¬µ«ä¯
ÀÀÆ÷ûÓбíʾҪ²ÎÕÕµÄÓïÑÔʱ£¬Ôò»Ø´« foo.html.fr ¡£
4.12 mod_userdir Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_userdir.c ÎļþÀ¶øÇÒÒÀÔ¤Éè»á±àÒë½øÀ´¡£Ëü
ÓÃÀ´Ìṩ´ú±íʹÓÃÕßµÄ(user-specific) Ŀ¼¡£
4.12.1 UserDir
Óï·¨: UserDir directory
Ô¤Éè: UserDir public_html
ÓÃì¶: server config, virtual host
״̬: »ù´¡
Ä£×é: mod_userdir
UserDir Õâ¸öÖ¸ÁîÉ趨ÔÚʹÓÃÕß×Ô¼Ò(home)Ŀ¼ÀïµÄÒ»¸öÕæʵĿ¼£¬µ±
½ÓÊÕµ½Ò»¸ö¶ÔʹÓÃÕßÎļþËù·¢³öµÄÇëÇóʱ»áʹÓÃÕâ¸öĿ¼¡£ Directory
¿ÉÒÔÊÇ Disable £¬ÓÃÀ´¹ØµôÕâÏîÌØÉ«£¬»òÕßÊÇÒ»¸öĿ¼µÄÃû³Æ¡£Èç¹û
ûÓйصô£¬ÄÇ÷áÒÔ http://myserver/~unix-username ×÷Ϊ¿ªÊ¼µÄÒ»¸ö
URL ÇëÇ󽫻ᱻת»»³ÉÒÔ home-dir/directory ×÷Ϊ¿ªÊ¼µÄÎļþÃû³Æ£¬
ÆäÖÐ home-dir ÊÇ unix-username Õâ¸öʹÓÃÕßµÄ×Ô¼ÒĿ¼¡£
¡õÀý:
UserDir public_html
ÄÇ÷áÒ»¸ö¶Ô http://myserver/~foo56/adir/file.html µÄÇëÇ󽫴«»Ø
http://myserver/home/foo56/public_html/adir/file.html Îļþ¡£
µÚÎåÕÂ
°¢ÅÁÆæÀ©³äÄ£×é
5.1 mod_auth_dbm Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_auth_dbm.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë½ø
È¥¡£ËüÌṩʹÓà DBM Îļþ×öʹÓÃÕßÑéÈϵŦÄÜ¡£²ÎÔÄ DBM µÄʹÓÃÕß
Îļþ¡£
5.1.1 AuthDbmGroupFile
Óï·¨: AuthDBMGroupFile ÎļþÃû³Æ
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: À©³ä
Ä£×é: mod_auth_dbm
AuthDBMGroupFile Õâ¸öÎļþÉ趨×÷ΪÑéÈÏÓÃµÄ DBM ÎļþÃû³Æ£¬ÆäÖÐ
°üº¬Ê¹ÓÃÕßȺ×éµÄÁÐ±í¡£ÎļþÃû³ÆÊǸÃȺ×éÎļþµÄ¾ø¶Ô·¾¶¡£
Õâ¸öÎļþÊÇÒÔʹÓÃÕßÃû³Æ×÷Ϊ¹Ø¼ü¡£¶øʹÓÃÕßááµÄÖµÔòÊǸÃʹÓÃÕßËùÊô
Ⱥ×éµÄÁÐ±í£¬ÒÔ¶ºµã·Ö¸ô¡£´ËÖµ²»ÄÜÓпհף¬¶øÇÒ²»ÄÜ°üº¬Ã°ºÅ¡£
°²È«: È·¶¨ AuthDBMGroupFile ´æ·ÅÔÚ·þÎñÆ÷µÄÎļþÊ÷Ö®Í⣻²»Òª°ÑËü
·ÅÔÚËüËùÒª±£»¤µÄĿ¼Àï¡£·ñÔò¿Í»§¶Ë½«ÄÜÏÂÔØ AuthDBMGroupFile ¡£
²ÎÔÄ AuthName, AuthType ÒÔ¼° AuthDBMUserFile ¡£
5.1.2 AuthDBMUserFile
Óï·¨: AuthDBMUserFile ÎļþÃû³Æ
ÓÃì¶: directory, .htaccess
ÐèÇó: AuthConfig
״̬: À©³ä
Ä£×é: mod_auth_dbm
AuthDBMUserFile Õâ¸öÎļþÉ趨×÷ΪÑéÈÏÖ®ÓÃµÄ DBM ÎļþÃû³Æ£¬ÆäÖÐ
°üº¬Ê¹ÓÃÕßÓëÃÜÂëµÄÁÐ±í¡£ÎļþÃû³ÆÊǸÃʹÓÃÕßÎļþµÄ¾ø¶Ô·¾¶¡£
Õâ¸öÎļþÊÇÒÔʹÓÃÕßÃû³Æ×÷Ϊ¹Ø¼ü¡£Ê¹ÓÃÕßááµÄÖµÊÇ crypt() ¼ÓÃܹý
µÄÃÜÂ룬Æäáá¿ÉÒÔ¼ÓÉÏÑ¡ÔñÐÔµÄðºÅÒÔ¼°ËæÒâµÄ×ÊÁÏ¡£·þÎñÆ÷½«»áºöÂÔ
ÕâЩðºÅ¸ú×ÊÁÏ¡£
°²È«: È·¶¨ AuthDBMUserFile ´æ·ÅÔÚ·þÎñÆ÷µÄÎļþÊ÷Ö®Í⣻²»Òª°ÑËü
·ÅÔÚËüËùÒª±£»¤µÄĿ¼Àï¡£·ñÔò¿Í»§¶Ë½«ÄÜÏÂÔØ AuthDBMUserFile ¡£
²ÎÔÄ AuthName, AuthType ÒÔ¼° AuthDBMGroupFile ¡£
5.2 mod_cookies Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_cookies.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë½ø
È¥¡£ËüÌṩ Netscape(TM) cookies ¡£Õâ¸öÄ£×éûÓÐ˵Ã÷Îļþ¡£
5.2.1 CookieLog
Óï·¨: CookieLog ÎļþÃû³Æ
ÓÃì¶: server config, virtual host
״̬: ʵÑé
Ä£×é: mod_cookies
CookieLog Õâ¸öÖ¸ÁîÉ趨¼Ç¼ cookies ÓõÄÎļþÃû³Æ¡£Õâ¸öÎļþÃû³Æ
ÊÇ ServerRoot µÄÏà¶ÔĿ¼¡£
5.3 mod_dld Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_dld.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë½øÈ¥¡£
ËüÌṩÔÚÆô¶¯Ê±ÔØÈë¿ÉÖ´ÐÐÎļþ¼°Ä£×éµ½·þÎñÆ÷ÀïÈ¥µÄ¹¦ÄÜ£¬Ê¹Óà GNU dld
³ÌÐò¿â¡£
5.3.1 ÕªÒª
Õâ¸öÑ¡ÓÃÐ﵀ dld Ä£×éÊÇÒ»¶Î×÷Ϊ¹ÛÄîÖ¤Ã÷(proof-of-concept)ÓõÄ
³ÌÐòÂ룬ËüÈçͬÅäÖÃ×Ô¼ºÒ»°ãÔØÈëÆäËüÄ£×éµ½·þÎñÆ÷ÀïÈ¥£¨Ö»ÓеÚÒ»´Î
£»Ä¿Ç°ÎªÖ¹£¬ÖØжÁÈ¡ÅäÖõµÎÞ·¨Ó°Ïìµ½ÒѾÔØÈëµÄÄ£×飩£¬Ê¹Óà GNU
µÄ¶¯Ì¬Á¬½á³ÌÐò¿â(DLD) ¡£ËüûÓÐÔ¤Éè±àÒë½øÈ¥£¬ÒòΪ²»ÊÇÿ¸öÈ˶¼ÓÐ
DLD £¬µ«ÊÇÎÒÔÚÊÔµÄʱºò¿ÉÒÔ¡££¨×¢Òâ×îáἸ¸ö×Ö£©¡£
×¢ÒâÒòΪijЩԵ¹Ê£¬LoadFile /lib/libc.a ¿´À´ËƺõÊDZØÐëµÄ¡£
×¢Òâ: µ±·þÎñÆ÷Æð¶¯Ê± DLD ÐèÒª¶ÁÈ¡ÔÚ·þÎñÆ÷³ÌÐòÖ®ÍâµÄ·ûºÅ±í¸ñ£»
Èç¹û·þÎñÆ÷ÔÚÆð¶¯Ê±²»ÄÜÕÒµ½Ëü×Ô¼ºµÄ³ÌÐòÂëÄÇ÷áÕâЩָÁî¾Í»áʧ°Ü¡£
5.3.2 LoadFile
Óï·¨: LoadFile ÎļþÃû³Æ ÎļþÃû³Æ ...
ÓÃì¶: server config
״̬: ʵÑé
Ä£×é: mod_dld
LoadFile Õâ¸öÖ¸ÁîÔÚ·þÎñÆ÷Æð¶¯Ê±Á´½áÆäËùÖ¸ÃûµÄÄ¿µÄµµ»ò³ÌÐò¿â£»
ÕâÊÇÓÃÀ´ÔØÈëijЩģ×éÔË×÷ʱҲÐíÐèÒªµÄ¶îÍâ³ÌÐòÂë¡£ÎļþÃû³ÆÊÇÏà¶Ô
ì¶ ServerRoot µÄ¡£
5.3.3 LoadModule
Óï·¨: LoadModule Ä£×é ÎļþÃû³Æ
ÓÃì¶: server config
״̬: ʵÑé
Ä£×é: mod_dld
LoaddModule Õâ¸öÖ¸ÁîÁ´½áÄ¿µÄµµ»ò³ÌÐò¿âµÄÎļþÃû³Æ²¢ÇÒ°ÑËùÖ¸ÃûµÄ
Ä£×é¼ÓÈëʹÓÃÖÐÄ£×éµÄÁÐ±í¡£Ä£×éÊÇÎļþÖÐÐÍ̬Ϊ module µÄÍⲿ²ÎÊý
¡£ÀýÈç:
LoadModule ai_backcompat_module modules/mod_ai_backcompat.o
LoadFile /lib/libc.a
ÔØÈë ServerRoot ÀïµÄ modules ×ÓĿ¼ÏµÄÄ£×é¡£
5.4 mod_log_agent Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_log_agent.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë
½øÈ¥¡£ËüÌṩ¿Í»§¶ËʹÓÃÕß³ÌÐòµÄ¼Ç¼¹¦ÄÜ¡£
5.4.1 AgentLog
Óï·¨: AgentLog Îļþ£¹ÜÏß
Ô¤Éè: AgentLog logs/agent_log
ÓÃì¶: server config, virtual host
״̬: À©³ä
Ä£×é: mod_log_agent
AgentLog Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷¼Ç¼½øÈëÖ®ÇëÇóµÄÎļþÃû³Æ£¬ÆäÄÚÈÝΪ
UserAgent ´Ë±êÍ·¡£Îļþ£¹ÜÏßÊÇÕâЩÆäÖÐÖ®Ò»:
Ò»¸öÎļþÃû³Æ
Ò»¸öÏà¶Ôì¶ ServerRoot µÄÎļþÃû³Æ
`|' ¸úËæÖøÒ»¸öÖ¸Áî
´Ó±ê×¼ÊäÈë½ÓÊղο¼¼Ç¼×ÊѶµÄ³ÌÐò¡£×¢ÒâÈç¹ûÐéÄâÖ÷»ú´ÓÖ÷Òª
·þÎñÆ÷¼Ì³Ð RefererLog É趨µÄ»°²»»áÆð¶¯ÐµijÌÐò¡£
°²È«: Èç¹ûÔÚ´ËʹÓóÌÐò£¬Ëü½«»áÒÔÆ𶯠httpd µÄʹÓÃÕßÉí·ÖÖ´ÐС£
Èç¹û·þÎñÆ÷ÓÉ root Æð¶¯ÄÇ÷á´Ë³ÌÐò¾ÍÊÇÓÉ root Ö´ÐУ»ËùÒÔҪȷ¶¨´Î
³ÌÐòµÄ°²È«ÐÔ¡£
Õâ¸öÖ¸ÁîÊÇΪÁËÓë NCSA 1.4 ÏàÈݶøÌṩµÄ¡£
5.5 mod_log_config Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_log_config.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë
½øÈ¥¡£ËüÌṩ¼Ç¼¶Ô·þÎñÆ÷Ö®ÇëÇóµÄ¹¦ÄÜ£¬Ê¹ÓÃÓÉʹÓÃÕßÖ¸¶¨µÄ¸ñʽ¡£
5.5.1 ÕªÒª
ÕâÊǸöʵÑéÐÔÖʵÄÄ£×飬Ëüʵ×÷ TransferLog Õâ¸öÖ¸ÁÓëÒ»°ã¼Ç¼
Ä£×éÏàͬ£©£¬ÒÔ¼°ÁíÒ»¸öÖ¸ÁLogFormat ¡£ÓдíÎóÒ²²»»áÈÃÎÒ¾ªÑÈ¡£
LogFormat µÄ²ÎÊýÊǸö×Ö´®£¬¿ÉÒÔ°üº¬Òª¸´ÖƵ½¼Ç¼µµÀïµÄÎÄ×Ö£¬ÒÔ¼°
ÈçÏÂËùÁÐµÄ `%' Ö¸Áî:
%...h: Ô¶¶ËÖ÷»ú
%...l: Ô¶¶ËµÄÇ©ÈëÃû³Æ£¨´Ó identd µÃÖª£¬Èç¹û¶Ô·½
ÓÐÖ§Ô®£©
%...u: Ô¶¶ËʹÓÃÕߣ¨´Ó auth µÃÖª£¬Èç¹û»Ø´«µÄ״̬
(%S)Ϊ 401 µÄ»°ÄÇÕâÓмÙÔìµÄ¿ÉÄÜ£©
%...t: ʱ¼ä£¬Ò»°ãµÄʱ¼ä¼Ç¼¸ñʽ
%...r: ÇëÇóµÄµÚÒ»ÐÐ
%...s: ״̬¡£ÓÃì¶Óöµ½ÄÚ²¿Öص¼µÄÇëÇó£¬ÕâÊÇ
{\bf original}ÇëÇóµÄ״̬ --- %...>s ÊÇ
×îááµÄ¡£
%...b: ËͳöµÄλԪ×é
%...{foobar}i: Foobar µÄÄÚÈÝ: ÒªËÍÍù¿Í»§¶ËÖ®ÇëÇóÀïÃæµÄ
±êÍ·ÐС£
%...{foobar}o: Foobar µÄÄÚÈÝ: Ôڻظ²(reply) ÀïµÄ±êÍ·ÐÐ
`...' Õâ¸ö²¿·Ý¿ÉÒÔÍêÈ«²»Òª(e.g. "%h %u %r %s %b") £¬»òÕßËü¿ÉÒÔ
±íʾҪ°üº¬Ä³ÏîÄ¿µÄÌõ¼þ£¨Èç¹û²»·ûºÏ¸ÃÌõ¼þÄÇ÷áËü»á±» `-' È¡´ú£©
¡£Òª×¢ÒâµÄÊÇ£¬ÔÚ×Ö´®É쵀 %r, %...i ÒÔ¼° %...o ûÓÐÍÑÀëµÄʵ×÷
(no escaping performed)£» ÓÐЩ¼ÇÐԺܺõÄÈË¿ÉÄܼǵÃÎÒÈÏΪÕâ²»ÊÇ
¸öºÃÖ÷Ò⣬ֱµ½ÏÖÔÚ£¬ÎÒÈÔÈ»¶ÔËüºÜ¸Ð𣬵«ÊÇÒª¿´³öÈçºÎÒÔ `%...i'
¡®×öÕýÈ·µÄÊ¡¯ÊǺÜÀ§Äѵģ¬³ý·ÇÎÒÃÇ URL-escape ÿһ¼þʲ¢ÒÔ CLF
´ò¶ÏËüÃÇ¡£
Ìõ¼þµÄÐÎʽÊÇÒ»·Ý HTTP ״̬ÂëµÄÁÐ±í£¬¿ÉÄÜÓÐÒ²¿ÉÄÜûÓÐ `!' Ç°µ¼
¡£Òò´Ë `%400,501{User-agent}i' ¼Ç¼ User-agent: Ö»¶Ô´íÎó״̬
400 ¼° 501£¨´íÎóÇëÇó£¬Ã»ÓÐʵ×÷£©×÷ÓÃ;`%!200,304,302{Referer}i'
¼Ç¼ Referer: ¶ÔËùÓÐû»Ø´«Õý³£×´Ì¬µÄÇëÇó×÷Óá£
Ô¤ÉèµÄ LogFormat ÖØÏÖ CFL; ÈçÏ¡£
ÅäºÏÐéÄâÖ÷»úʹÓõÄÏë·¨ÈçÏÂ: ÐéÄâÖ÷»ú¿ÉÒÔÓµÓÐËü×Ô¼ºµÄ LogFormat
£¬»òÊÇËü×Ô¼ºµÄ TransferLog¡£Èç¹ûËüûÓÐ×Ô¼ºµÄ LogFormat£¬Ëü¾Í´Ó
Ö÷Òª·þÎñÆ÷¼Ì³Ð¡£Èç¹ûËüûÓÐ×Ô¼ºµÄ TransferLog£¬Ëû¾Íдµ½ÏàͬµÄÃè
Êö×Ó(descriptor)È¥£¨ÒâÖ¸ÏàͬµÄ `|...' ³ÌÐò£©¡£
ÕâÒâνÄã¿ÉÒÔÏñÕâÑù×ö:
<VirtualHost hosta.com>
LogFormaat "hosta ..."
...
<VirtualHost>
<VirtualHost hosta.com>
LogFormat "hostb ..."
...
</VirtualHost>
... ʹ²»Í¬µÄÐéÄâ·þÎñÆ÷дµ½ÏàͬµÄ¼Ç¼µµÈ¥£¬µ«ÈÔÈ»ÓÐЩ¹Øì¶ËüÃÇ´Ó
Äĸö·þÎñÆ÷¶øÀ´µÄ±êʾ£¬ËäȻʹÓà %v Ö¸Áî¿ÉÄÜ»áÊÇ´¦ÀíÕâ¸öÇé¿ö±È½Ï
ºÃµÄ·½·¨¡£¶à¼Ó×¢Òâ´Ë¸ñʽµÄ¸Ä±ä¡£
5.5.2 LogFormat
Óï·¨: LogFormat ×Ö´®
Ô¤Éè: LogFormat "%h %l %u %t \"%r\" %s %b"
ÓÃì¶: server config, virtual host
״̬: ʵÑé
Ä£×é: mod_log_config
ÕâÉ趨¼Ç¼µµµÄ¸ñʽ¡£
5.5.3 TransferLog
Óï·¨: TransferLog Îļþ£¹ÜÏß
Ô¤Éè: TransferLog logs/transfer_log
ÓÃì¶: server config, virtual host
״̬: ʵÑé
Ä£×é: mod_log_config
TransferLog Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷¼Ç¼½øÈëÖ®ÇëÇóµÄÎļþÃû³Æ¡£Îļþ£
¹ÜÏßÊÇÏÂÁÐÆäÖÐÖ®Ò»
Ò»¸öÎļþÃû³Æ
Ò»¸öÏà¶Ôì¶ ServerRoot µÄÎļþÃû³Æ
`|' ¸úËæÖøÒ»¸öÖ¸Áî
´Ó±ê×¼ÊäÈë½ÓÊղο¼¼Ç¼×ÊѶµÄ³ÌÐò¡£×¢ÒâÈç¹ûÐéÄâÖ÷»ú´ÓÖ÷Òª
·þÎñÆ÷¼Ì³Ð RefererLog É趨µÄ»°²»»áÆð¶¯ÐµijÌÐò¡£
°²È«: Èç¹ûÔÚ´ËʹÓóÌÐò£¬Ëü½«»áÒÔÆ𶯠httpd µÄʹÓÃÕßÉí·ÖÖ´ÐС£
Èç¹û·þÎñÆ÷ÓÉ root Æð¶¯ÄÇ÷á´Ë³ÌÐò¾ÍÊÇÓÉ root Ö´ÐУ»ËùÒÔҪȷ¶¨´Î
³ÌÐòµÄ°²È«ÐÔ¡£
5.6 mod_log_refer Ä£×é
Õâ¸öÄ£×é°üº¬ÔÚ mod_log_refer.c Õâ¸öÎļþÀ¶øÇÒÒÀÔ¤Éè²»»á±àÒë
½øÈ¥¡£ËüÌṩµÄ¹¦ÄÜÊǼǼ²ÎÕÕµ½´Ë·þÎñÆ÷ÉÏÖ®ÎļþµÄÎļþ¡£
5.6.1 ¼Ç¼µµµÄ¸ñʽ
¼Ç¼µµÎªÃ¿¸ö²Î¿¼¼Ç¼¸ö±ðµÄÒ»ÐС£Ã¿Ò»Ðеĸñʽ
uri -> Îļþ
ÆäÖÐ uri ÊÇ¿Í»§¶ËÒªÇóËù²Î¿¼Ö®ÎļþµÄ(%-escaped) URI £¬¶øÎļþÔò
ÊDZ»²Î¿¼Ö®ÎļþµÄ(%-decode)±¾µØ URL ¡£
5.6.2 RefererIgnore
Óï·¨: RefererIgnore ×Ö´® ×Ö´® ...
ÓÃì¶: server config, virtual config
״̬: À©³ä
Ä£×é: mod_log_refer
RefererIgnore Õâ¸öÖ¸Áî°ÑÒªºöÂԵIJο¼±êÍ·(Referer headers) ¼ÓÈë
×Ö´®ÁбíÖС£Èç¹û²Î¿¼±êÍ·Öаüº¬´ËÁбíÀïµÄÈκÎ×Ö´®£¬ÄÇ÷á²»»á¼Ç¼
¸ÃÇëÇóµÄ²Î¿¼×ÊѶ¡£ÀýÈç:
RefererIgnore www.ncsa.uiuc.edu
Õâ»á±ÜÃâ¼Ç¼À´×Ô www.ncsa.uiuc.edu µÄ²Î¿¼¡£
5.6.3 RefererLog
Óï·¨: RefererLog Îļþ£¹ÜÏß
ÓÃì¶: server config, virtual config
״̬: À©³ä
Ä£×é: mod_log_refer
RefererLog Õâ¸öÖ¸ÁîÉ趨·þÎñÆ÷¼Ç¼½øÈëÖ®ÇëÇóµÄÎļþÃû³Æ£¬ÆäÄÚÈÝ
Ϊ²Î¿¼±êÍ·¡£Îļþ£¹ÜÏßÊÇÕâЩÆäÖÐÖ®Ò»:
Ò»¸öÎļþÃû³Æ
Ò»¸öÏà¶Ôì¶ ServerRoot µÄÎļþÃû³Æ
`|' ¸úËæÖøÒ»¸öÖ¸Áî
´Ó±ê×¼ÊäÈë½ÓÊղο¼¼Ç¼×ÊѶµÄ³ÌÐò¡£×¢ÒâÈç¹ûÐéÄâÖ÷»ú´ÓÖ÷Òª
·þÎñÆ÷¼Ì³Ð RefererLog É趨µÄ»°²»»áÆð¶¯ÐµijÌÐò¡£
°²È«: Èç¹ûÔÚ´ËʹÓóÌÐò£¬Ëü½«»áÒÔÆ𶯠httpd µÄʹÓÃÕßÉí·ÖÖ´ÐС£
Èç¹û·þÎñÆ÷ÓÉ root Æð¶¯ÄÇ÷á´Ë³ÌÐò¾ÍÊÇÓÉ root Ö´ÐУ»ËùÒÔҪȷ¶¨´Î
³ÌÐòµÄ°²È«ÐÔ¡£
Õâ¸öÖ¸ÁîÊÇΪÁËÓë NCSA 1.4 ÏàÈݶøÌṩµÄ¡£
µÚÁùÕÂ
°¢ÅÁÆæÓ¦ÓóÌÐò½çÃæ×¢ÒâÊÂÏî £¨ÂÔ£©
--
¡ù À´Ô´:£®×Ï ¶¡ Ïã bbs.hit.edu.cn£®[FROM: 202.118.244.16]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º815.380ºÁÃë