Apache HTTP Server �汾2.2
˵�� | ����Э�����ͶԼ���Socket�����Ż� |
---|---|
� | AcceptFilter protocol accept_filter |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.1.5 �Ժ�İ汾�п��� |
���ָ��ʹ�ò���ϵͳ����Э�����ͶԼ���socket�����ر���Ż��������ǰ�����ں������ݽ�����ϻ�һ��������HTTP�������ǰ������������̷���socket ��Ŀǰ��֧��FreeBSD�Ľ��չ�����(Accept Filter)��Linux�ĸ�ԭʼ��(more primitive)TCP_DEFER_ACCEPT
��
FreeBSD�ϵ�Ĭ��ֵ�ǣ�
AcceptFilter http httpready
AcceptFilter https dataready
httpready
���չ�����(Accept Filter)���ں˼�������HTTP����һ��һ�������屻�������գ��ں˽������������������μ�accf_http(9)�ֲ�ҳ�Ի�ø���ϸ����Ϣ����ΪHTTPS�����Ѿ��������ˣ�����ֻʹ����accf_data(9)��������
Linux�ϵ�Ĭ��ֵ�ǣ�
AcceptFilter http data
AcceptFilter https data
Linux��TCP_DEFER_ACCEPT
����֧�ֶ�http������л��塣��none
֮����κ�ֵ�����ڼ�������������TCP_DEFER_ACCEPT
���μ�tcp(7)�ֲ�ҳ�Ի�ø������顣
ʹ��none
����Ϊ�Ǹ�Э����ý��չ�����(accept filter)���������nntp
������Ҫ�������ȷ������ݵ�Э������ô���
AcceptFilter nttp none
˵�� | �Ƿ���ܸ�������·������Ϣ������ |
---|---|
� | AcceptPathInfo On|Off|Default |
Ĭ��ֵ | AcceptPathInfo Default |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.0.30 ���Ժ�İ汾�п��� |
��ָ������Ƿ������ʵ���ļ���(��ʵ��Ŀ¼��һ�������ڵ��ļ�)��������·������Ϣ��������������·������Ϣ���Ե���PATH_INFO
�����������ݸ��ű���
����˵������/test/
��ָ���Ŀ¼��ֻ����һ���ļ���here.html
����ô��/test/here.html/more
��/test/nothere.html/more
�����ὫPATH_INFO
����������Ϊ"/more
"��
AcceptPathInfo
ָ���ȡֵ��Χ��
Off
/test/here.html/more
��������ʵ�ļ��������һ��·���������᷵��һ��"404 NOT FOUND"����On
/test/here.html
�ܹ�ӳ�䵽һ����Ч���ļ�����ô��/test/here.html/more
������ͻᱻ���ա�Default
PATH_INFO
���������ŷ��ű��Ĵ�����������cgi-script��isapi-isa��Ĭ�ϻ����PATH_INFO
��AcceptPathInfo
ָ����ڵ���ҪĿ�ľ������������Ǵ����������Ƿ����PATH_INFO
��Ĭ�����á����ָ����Ǻܱ�Ҫ�ġ�����˵������ʹ��������INCLUDES������������������PATH_INFO
��������ʱ�����Ĵ�����ͨ����ܾ��������������Ϳ���������������ʹ�����Ľű���Ϊ���ܣ�
<Files "mypaths.shtml">
Options +Includes
SetOutputFilter INCLUDES
AcceptPathInfo On
</Files>
˵�� | �ֲ�ʽ�����ļ������� |
---|---|
� | AccessFileName filename |
Ĭ��ֵ | AccessFileName .htaccess |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
���Ϊij��Ŀ¼�����˷ֲ�ʽ�����ļ���������ô����ͻ��˷������е��ĵ�ʱ����������������ĵ����ڵĸ���Ŀ¼�в��Ҵ������ļ������磺
AccessFileName .acl
�ڷ����ĵ�/usr/local/web/index.html
֮ǰ����������Ϊ��ָ���ȡ /.acl
��/usr/.acl
��/usr/local/.acl
��/usr/local/web/.acl
���Ǵ˹����Ա��������������ã�
<Directory />
AllowOverride None
</Directory>
˵�� | ��Ӧ��������text/plain ��text/html ʱ����HTTPӦ��ͷ�м����Ĭ���ַ��� |
---|---|
� | AddDefaultCharset On|Off|charset |
Ĭ��ֵ | AddDefaultCharset Off |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
���ҽ���Ӧ��������text/plain
��text/html
ʱ����ָ�����HTTPӦ��ͷ�м����Ĭ���ַ������������⽫�������ĵ�����ͨ��<meta>
��ǩָ�����ַ���������ʵ�ʵ���Ϊͨ��ȡ�����û�����������á�AddDefaultCharset Off
������ô˹��ܡ�AddDefaultCharset On
������Apache�ڲ���Ĭ���ַ���iso-8859-1
����Ҳ����ָ��ʹ����IANAע������ַ��������е�����һ��charset ������˵��
AddDefaultCharset utf-8
AddDefaultCharset
ֻӦ�������������ʹ�ã������ı���Դ��ʹ��ͬһ��ȷ�����ַ������ҷֱ������ǵ��ַ����dz��鷳��һ���������������������̬���ݵ���Դ������ַ�������(������ǰ������CGI�ű�)���������ܻ���Ϊ������а����û��ṩ�����ݶ����¿�վ��ű�������������ע�⣺���õĽ���취���Ļ�ɾ����Щ�ű�����Ϊ������Ĭ�ϵ��ַ����Ժ�ʹ����������ַ����Զ�̽���ʧЧ��
˵�� | ���ض���MIME����ָ����������� |
---|---|
� | AddOutputFilterByType filter[;filter...] MIME-type [MIME-type] ... |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | Apache 2.0.33 �Ժ���ã�����Apache 2.1 �Ժ�ʹ�� |
��ָ�����Ӧ���MIME�����������ض���������������������潫Ҫ���۵����⣬���Ƿ���ʹ�����ָ�ͬ���Ĺ��ܿ���ͨ��ʹ��mod_filter
ģ���á�
����ʹ������mod_deflate
�ṩ��DEFLATE
��������������������text/html
��text/plain
Ϊ��ǵ����(���۾�̬��̬)�ڷ��͵��ͻ���֮ǰ����ѹ����
AddOutputFilterByType DEFLATE text/html text/plain
�����ϣ��ʹ�ö�����������������ݣ��������÷ֺ�(;)���ָ����ǵ����֡�����ÿ��������ʹ��AddOutputFilterByType
ָ�
�������ý�ʹ���б��Ϊtext/html
�Ľű�������ȱ�INCLUDES
������������ٱ�DEFLATE
����������
<Location /cgi-bin/>
Options Includes
AddOutputFilterByType INCLUDES;DEFLATE text/html
</Location>
��ijЩ����£���AddOutputFilterByType
��ʹ�ù����������ܲ��ֻ���ȫ��ʧ�ܡ����磬���MIME��������ȷ������ô�������й������������ϣ��Ӷ�ʹ֮�ص�DefaultType
�����������DefaultType
������ͬ��ʱ��Ҳ��������
Ȼ�����������ȷ�϶�ijЩ��Դ��ص���������ȷʵʹ���˹�������������ʹ��������AddType
��ForceType
�����İ취����һ��(non-nph)CGI�ű����趨��������Ҳ�ܰ�ȫ��
�����;����������������Զ�������������Դ��������
˵�� | ȷ���Ƿ�����URL��ʹ�þ��������·���ָ�� |
---|---|
� | AllowEncodedSlashes On|Off |
Ĭ��ֵ | AllowEncodedSlashes Off |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.0.46 ���Ժ�İ汾�п��� |
AllowEncodedSlashes
ָ������ʹ�ð������������·���ָ����URL("%2F
"��"/
"��"%5C
"��"\
"��ȡ���ڲ�ͬ��ϵͳ)��Ĭ������£���ЩURL����һ������"404"(δ�ҵ�)�����Ӧ��ܾ���
AllowEncodedSlashes
On
ͨ����PATH_INFO
���ʹ�á�
����ʹ�þ��������б��(·���ָ��)������ζ�Ž�����%2F
��%5C
(����ȡ���ڲ�ͬ��ϵͳ)���ᰴԭ�������ڽ�����URL�ַ����С�
˵�� | ȷ�����������.htaccess �ļ��е�ָ������ |
---|---|
� | AllowOverride All|None|directive-type
[directive-type] ... |
Ĭ��ֵ | AllowOverride All |
������ | directory |
״̬ | ����(C) |
ģ�� | core |
������������һ��.htaccess
�ļ�(��AccessFileName
ָ��)ʱ������Ҫ֪��������ļ�����������Щָ���ܸ����ڴ�֮ǰָ��������ָ�
AllowOverride
���ڲ�����������ʽ��<Directory>
���ö��в�����Ч�ġ���<Location>
, <DirectoryMatch>
, <Files>
���ö��ж�����Ч�ġ������ָ�����ΪNone
����ô.htaccess�ļ�������ȫ���ԡ���ʵ�ϣ����������������ȡ.htaccess
�ļ���
����ָ������Ϊ All
ʱ�����о���".htaccess"��������ָ����������.htaccess
�ļ��С�
directive-type���������и���ָ��֮һ��
AuthDBMGroupFile
, AuthDBMUserFile
, AuthGroupFile
, AuthName
, AuthType
, AuthUserFile
, Require
, ��)��DefaultType
, ErrorDocument
, ForceType
, LanguagePriority
, SetHandler
, SetInputFilter
, SetOutputFilter
, mod_mime
�е� Add* �� Remove* ָ��ȵ�)�������ĵ�Ԫ���ݵ�ָ��(Header
, RequestHeader
, SetEnvIf
, SetEnvIfNoCase
, BrowserMatch
, CookieExpires
, CookieDomain
, CookieStyle
, CookieTracking
, CookieName
)��mod_rewrite
�е�ָ��(RewriteEngine
, RewriteOptions
, RewriteBase
, RewriteCond
, RewriteRule
)��mod_actions
�е�Action
ָ�AddDescription
, AddIcon
, AddIconByEncoding
, AddIconByType
, DefaultIcon
, DirectoryIndex
, FancyIndexing
, HeaderName
, IndexIgnore
, IndexOptions
, ReadmeName
, ��)��Allow
, Deny
, Order
)��Options
��XBitHack
)�������ڵȺź��渽��һ�����ŷָ���(�ո��)Options
ѡ���б�������������Options
ָ��ʹ����Щѡ���������ָ��ֻ������.htaccess
��ʹ��AuthConfig
��Indexes
���ָ�
AllowOverride AuthConfig Indexes
�����������е�ָ��ᵼ�·���������һ���ڲ�����
˵�� | ����HTTP��֤����Ȩ�� |
---|---|
� | AuthName auth-domain |
������ | directory, .htaccess |
������ | AuthConfig |
״̬ | ����(C) |
ģ�� | core |
��ָ��ΪĿ¼����Ȩ���������֡��������ͻ�����ʹ�û��˽�Ӧ�������ĸ��û��������롣AuthName
ָ�����һ�������������������а����ո����������������������������AuthType
��Require
ָ���Լ�����AuthUserFile
��AuthGroupFile
������ָ��һ������
���磺
AuthName "Top Secret"
�ṩ��AuthName
���ַ����������ڴ����������ṩ������Ի����С�
˵�� | �û���֤���� |
---|---|
� | AuthType Basic|Digest |
������ | directory, .htaccess |
������ | AuthConfig |
״̬ | ����(C) |
ģ�� | core |
��ָ��ѡ����һ��Ŀ¼���û���֤���͡�Ŀǰֻʵ����Basic
(mod_auth_basic
)��Digest
(mod_auth_digest
)��
Ҫʵ����֤��������ͬʱ��AuthName
��Require
ָ��һ��ʹ�á����⣬���������������һ����֤֧��ģ��(����mod_authn_file
)��һ����Ȩ֧��ģ��(����mod_authz_user
)��
˵�� | ��λCGI�ű������� |
---|---|
� | CGIMapExtension cgi-path .extension |
������ | directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | NetWare only |
��ָ�����ڶ�λApache CGI�ű������������磬"CGIMapExtension sys:\foo.nlm .foo
"���������.foo
����CGI�ű��ļ����ݸ�FOO��������
˵�� | ��������Content-MD5 Ӧ��ͷ |
---|---|
� | ContentDigest On|Off |
Ĭ��ֵ | ContentDigest Off |
������ | server config, virtual host, directory, .htaccess |
������ | Options |
״̬ | ����(C) |
ģ�� | core |
��ָ������RFC1854��RFC2068Э��Ķ���������Content-MD5
Ӧ��ͷ�����ɡ�
MD5��һ��Ϊ�������ȵ����ݼ����һ��"��ϢժҪ"(��ʱҲ��Ϊ"ָ��")���㷨�����ұ�֤�����е��κα仯���ᷴӦ����ϢժҪ�ı仯�С�
Content-MD5
ͷ�ṩ��һ�ֶ˵��˵����������Ϣ�����Ϣ�����Լ�鷽����������߿ͻ��˻����ͷ������ڴ�������У���Ϣ���Ƿ����������ĸı䡣һ��ͷ���������£�
Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
��ע�⣬��Ϊ��ÿ������Ҫ������ϢժҪ������(û�ж���ֵ���л���)�������������ķ�����������ܷ����Ӱ�졣
Content-MD5
����Apache����
�ŷ����ĵ����з��ͣ���������ģ�鴦����ĵ�������ᡣ����˵SSI�ĵ���CGI�ű���������ֽڷ�Χ��Ӧ���������ͷ��
˵�� | �ڷ�����������������ȷ����������ʱ�����͵�Ĭ��MIME�������� |
---|---|
� | DefaultType MIME-type |
Ĭ��ֵ | DefaultType text/plain |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
��ʱ�ᷢ���������£��������ᱻҪ���ṩһ���ĵ���������ĵ���������������MIME����ӳ����������
����������֪ͨ�ͻ������ĵ����������͡����Ե�һ��δ֪���ͳ���ʱ������ʹ��DefaultType
�����磺
DefaultType image/gif
���������ö��������кܶ�gifͼƬ����Щ���ļ�����ȱ��.gif
��չ����Ŀ¼�dz����ʡ�
ע�⣬��ForceType
ָ��IJ�֮ͬ�����ڣ���ָ����ṩ��Ĭ�ϵ�mime���͡���������mime���͵Ķ��壬�����ļ�����չ�������������Ա�ʶý�����͵ķ������Ḳ�Ǵ�Ĭ��ֵ��
˵�� | ��װһ��ָ�ʹ֮�����ļ��ռ��е�ij��Ŀ¼������Ŀ¼��Ч |
---|---|
� | <Directory directory-path>
... </Directory> |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
<Directory>
��</Directory>
���ڷ�װһ��ָ�ʹ֮����ij��Ŀ¼������Ŀ¼��Ч���κο�����"directory"��������ʹ�õ�ָ�����ʹ�á�Directory-path������һ��Ŀ¼������·�������ǰ�����Unix shellƥ�����ͨ����ַ�������ͨ����ַ����У�"?
"ƥ���κε������ַ���"*
"ƥ���κ��ַ����С���Ҳ����ʹ��"[]
"��ȷ���ַ���Χ������ͨ���������ƥ��"/"�ַ�������<Directory /*/public_html>
����ƥ��/home/user/public_html
����<Directory /home/*/public_html>
�ܹ���ȷƥ�䡣����˵��
<Directory /usr/local/httpd/htdocs>
Options Indexes FollowSymLinks
</Directory>
ʹ��directory-path������ʱ��Ҫע�⣺���DZ�����Apache���ڷ����ļ����ļ�ϵͳ·������һ�¡������ض�<Directory>
��ָ�����ͨ����ͬ·��ָ���ͬһ��Ŀ¼�ļ���Ч������˵ͨ������һ�������������ɵ�·����
��չ��������ʽҲ����ͨ������һ��"~
"�ַ���ʹ�á�����˵��
<Directory ~ "^/www/(.+/)*[0-9]{3}">
��ƥ��/www/
��������3��������ɵ�Ŀ¼��
����ж��(��������ʽ)<Directory>
���öη��ϰ���ij�ĵ���Ŀ¼(���丸Ŀ¼)����ôָ��Զ�Ŀ¼���ȵĹ������Ӧ�á�������.htaccess�ļ��е�ָ�����˵��
<Directory />
AllowOverride None
</Directory>
<Directory /home/>
AllowOverride FileInfo
</Directory>
�У������ĵ�/home/web/dir/doc.html
�IJ������£�
AllowOverride None
(����.htaccess
�ļ�)��AllowOverride FileInfo
(���/home
Ŀ¼)��/home/.htaccess
��/home/web/.htaccess
��/home/web/dir/.htaccess
�е�FileInfo
��ָ�������ʽ����������ͨ���ö�֮�����Կ��ǡ����е�������ʽ���������dz����������ļ��е�˳�����Ӧ�á�����˵���������ã�
<Directory ~ abc$>
# ......
</Directory>
������ʽ���öν���������ͨ��<Directory>
��.htaccess
�ļ�Ӧ��֮������Կ��ǡ�����������ʽ��ƥ��/home/abc/public_html/abc
������Ӧ�á�
��ע�⣺Apache��<Directory />
��Ĭ�Ϸ���Ȩ��Ϊ"Allow from All
"������ζ��Apache���ŷ��κ�ͨ��URLӳ����ļ������ǽ�����������������������Σ�
<Directory />
Order Deny,Allow
Deny from All
</Directory>
Ȼ��������Ҫʹ֮�����ʵ�Ŀ¼�и��Ǵ����á�������ȫ��ʾ�Ի�ȡ�������顣
һ����˵<Directory>
ָ��ֻ�������httpd.conf
�ļ��У�������Ҳ���ܳ������κ����������ļ��С�<Directory>
ָ��ɱ�Ƕ��ʹ�ã�Ҳ���ܳ�����<Limit>
��<LimitExcept>
���ö��С�
˵�� | ��װһЩָ��������ļ�ϵͳ��ƥ��������ʽ������Ŀ¼������Ŀ¼ |
---|---|
� | <DirectoryMatch regex>
... </DirectoryMatch> |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
<DirectoryMatch>
��</DirectoryMatch>
���ڷ�װһ��ָ���<Directory>
���ƣ���ָ���������ָ�����ֵ�Ŀ¼������Ŀ¼��Ȼ���������Խ���һ��������ʽ��Ϊ����������˵��
<DirectoryMatch "^/www/(.+/)*[0-9]{3}">
��ƥ��/www/
��������3��������ɵ�Ŀ¼��
<Directory>
��ȡ�������ͨ��<Directory>
��ʹ��������ʽ��������˵�� | ��������Ͽɼ������ĵ����ĸ�Ŀ¼ |
---|---|
� | DocumentRoot directory-path |
Ĭ��ֵ | DocumentRoot /usr/local/apache2/htdocs |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
��ָ��������httpd
�ŷ���Ŀ¼����û��ʹ������Alias
������ָ�������£��������Ὣ�����е�URL���ӵ�DocumentRoot
�����Թ���ָ���ĵ���·��������˵��
DocumentRoot /usr/web
���Ƕ�http://www.my.host.com/index.html
�ķ��ʾͻ�ָ��/usr/web/index.html
�����directory-path���Ǿ���·�����ٶ�Ϊ�������ServerRoot
��·����
ָ��DocumentRoot
ʱ��Ӧ��������"/"��
˵�� | �ڵ�����ʹ���ڴ�ӳ��(memory-mapping)����ȡ�ļ� |
---|---|
� | EnableMMAP On|Off |
Ĭ��ֵ | EnableMMAP On |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
��ָ��ָʾhttpd
�ڵ����������Ҫ��ȡһ���ļ������ݣ����Ƿ����ʹ���ڴ�ӳ�䡣������һ����Ҫ�����ļ��е����ݵ�����ʱ������˵������һ��ʹ��mod_include
���з������˷������ļ�ʱ���������ϵͳ֧�֣�Apache��Ĭ��ʹ���ڴ�ӳ�䡣
�����ڴ�ӳ����ʱ��������ܵ���ߣ�����ijЩ����£������ܻ���Ҫ�����ڴ�ӳ���Ա���һЩ����ϵͳ�����⣺
httpd
�����ܡ�DocumentRoot
�ϣ����Ѿ���һ���ļ��������ڴ�ӳ�䣬��ɾ����ض�����ļ������httpd
��Ϊ�ֶι��϶��������ڿ���������Щ����ķ��������ù����У���Ӧ��ʹ������������������ڴ�ӳ�䣺
EnableMMAP Off
���ڹ�����NFS���ļ��У����Ե���ָ�������ڴ�ӳ�䣺
<Directory "/path-to-nfs-files">
EnableMMAP Off
</Directory>
˵�� | ʹ�ò���ϵͳ�ں˵�sendfile֧�������ļ����͵��ͻ��� |
---|---|
� | EnableSendfile On|Off |
Ĭ��ֵ | EnableSendfile On |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.0.44 ���Ժ�İ汾�п��� |
���ָ�����httpd
�Ƿ����ʹ�ò���ϵͳ�ں˵�sendfile֧�������ļ����͵��ͻ��ˡ�Ĭ������£�������һ��������Ҫ�����ļ��ڲ�������ʱ(���緢��һ����̬���ļ�����)���������ϵͳ֧�֣�Apache��ʹ��sendfile���ļ�����ֱ�ӷ��͵��ͻ��˶�������ȡ�ļ���
���sendfile���Ʊ����˷ֿ��Ķ���д�����Լ����������䣬������һЩƽ̨����һЩ�ļ�ϵͳ�ϣ���ý�ֹ�������������һЩ���⣺
DocumentRoot
(���磺NFS��SMB)���ں˿������ɿ���ͨ���Լ��Ļ����������������ļ���������������������Ӧ������sendfile ��
EnableSendfile Off
���NFS��SMB�����ָ����Ա����Ŀ¼�����ø��ǣ�
<Directory "/path-to-nfs-files">
EnableSendfile Off
</Directory>
˵�� | �����������ʱ������������ͻ���ʲô����Ӧ�� |
---|---|
� | ErrorDocument error-code document |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | ��Apache2.0���������ֵ�������˱仯 |
���������������ʱ��Apache�ܱ�����Ϊ�����������ִ���֮һ��
Ĭ�ϻ��ȡ��1�ַ���������2-4�ַ�������ʹ��ErrorDocument
ָ��������һ��HTTPӦ������һ��URL����Ϣ���������á�Apache��ʱ������ṩһЩ��Ϣ������������������/����
URL������һ��б��(/)��ͷ��ָʾһ������URL(�����DocumentRoot
)�������ṩһ���ܱ��ͻ��˽��͵�������URL��������ṩһ�����Ա��������ʾ����Ϣ�����磺
ErrorDocument 500 http://foo.example.com/cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 "Sorry can't allow you access today"
���⣬�����"default
"ֵ���Ա�����ָ��ʹ��Apache���õġ���Ӳ������Ϣ��������Ҫ����������Ե�ʱ������"default
"�ָ�Apache���õġ���Ӳ������Ϣ�����̳�һ�����е�ErrorDocument
��
ErrorDocument 404 /cgi-bin/bad_urls.pl
<Directory /web/docs>
ErrorDocument 404 default
</Directory>
��ע�⣬�����ΪErrorDocument
ָ����һ���ⲿ��URL(����˵���κ��ڿ�ͷָʾ������"http
"�����ķ��ʷ������ַ���)��Apache������ͻ��˷���һ���ض���ָ�����������������ҵ�����ĵ�����������ĵ������������������ϡ������������һЩ��ʾ������Ҫ�ľ��ǿͻ��������յ�ԭʼ�Ĵ���״̬���룬ȡ����֮����һ���ض���״̬���롣�⽫��ʹһЩ��״̬�������ж�һ��URL�Ƿ���Ч��web�����˻������ͻ��˲�����⡣���⣬�������"ErrorDocument 401
"��ʹ�����ⲿURL���ͻ��˽�������ʾ�û��������룬��Ϊ������û�յ�����һ��401��״̬���롣���ԣ��������ʹ��"ErrorDocument 401
"ָ��ͱ���ָ��һ�����ص��ĵ���
Microsoft Internet Explorer (MSIE)�ڷ������˲����Ĵ�����Ϣ"��С"��ʱ���������Ƕ����Լ�"�Ѻõ�"������Ϣ����ȡ���������С����ֵ���ݴ������Ͷ���ͬ����һ����˵��������Ĵ�����Ϣ�Ĵ�С��512 byte���ϣ�MSIE�ͻ���ʾ��Щ�������˲����Ĵ����ĵ��������������ǡ�����������֪ʶ�������Q294807�л�ȡ������Ϣ��
��Ȼ�����������Ϣ���Ա���д����������Щ����£�����Ȼʹ��ijЩ���õĴ�����Ϣ������ErrorDocument
������á��ر����ڼ�һ��"����"���������£���������������̽��ᱻ�����жϣ�������������һ�����õĴ�����Ϣ������Ϊ�˷�ֹijЩ����������ܵ��µİ�ȫ���⡣
��2.0����ǰ����Ϣǰ�����һ������Ե�˫������Ϊǰ����־��
˵�� | ��Ŵ�����־��λ�� |
---|---|
� | ErrorLog file-path|syslog[:facility] |
Ĭ��ֵ | ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows �� OS/2) |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
ErrorLog
ָ��ָ���˵���������������ʱ��¼������־���ļ������file-path����һ����б��(/)��ͷ�ľ���·������ô������Ϊ��һ�������ServerRoot
�����·����
ErrorLog /var/log/httpd/error_log
���file-path��һ���ܵ�����(|)��ͷ����ô��Ϊ��ָ��һ�����������������־��
ErrorLog "|/usr/local/bin/httpd_errors"
���ϵͳ֧�֣�ʹ��"syslog
"����ļ�����ͨ��syslogd(8)��������־��Ĭ�Ͻ�ʹ��ϵͳ��־����local7
������������"syslog:facility
"�������������ã����У�facility��ȡֵΪsyslog(1)�м��ص��κ�һ�����֡�
ErrorLog syslog:user
��ȫ��ʾ��������ȫ��ʾ�ĵ���ù���Ϊʲô����¼��־�ļ���Ŀ¼��������������������û���дʱ������ķ��������ɰ�ȫ��в��
���ڷ�Unixƽ̨�������ļ�·����ʱ��·���ָ�������ͳһʹ����б��(/)����ʹ�Ǹ�ƽ̨����ʹ�÷�б��(\)��
˵�� | ���Դ���ETagӦ��ͷ���ļ������� |
---|---|
� | FileETag component ... |
Ĭ��ֵ | FileETag INode MTime Size |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
FileETag
ָ�������˵��ĵ��ǻ���һ���ļ�ʱ���Դ���ETag
(ʵ���ǩ)Ӧ��ͷ���ļ�������(ETag
��ֵ���ڽ��л�������Խ�Լ�������)����Apache1.3.22����ǰ��ETag
��ֵ�������ļ���inode(�����ڵ�)����С�������ʱ�������FileETag
ָ���������ѡ��(����������ѡ��)��������ЩҪ�ؽ���ʹ�á���Ҫ�ؼ������£�
FileETag INode MTime Size
ETag
ͷ������INode
, MTime
, Size
ǰ����"+
"��"-
"�Ըı����ϲ�̳�������Ĭ��ֵ���κ�û������ǰ�Ĺؼ��ֽ�������ȫȡ���̳����������á�
���һ��Ŀ¼�����ð�����"FileETag INode MTime Size
"����һ����Ŀ¼������"FileETag -INode
"��ô�����Ŀ¼������(���ᱻ�����κ�û�н��и��ǵ���Ŀ¼�̳�)���ȼ���"FileETag MTime Size
"��
˵�� | ����������ƥ��ָ���ļ�����ָ�� |
---|---|
� | <Files filename> ... </Files> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
<Files>
ָ���ṩ�˻����ļ����ķ��ʿ��ƣ�������<Directory>
��<Location>
ָ��������һ��</Files>
ָ��ڴ����ö��ж����ָ����������������(����������·��)��ָ�����ļ�������Ķ���<Files>
�ν����������������ļ��г��ֵ�˳������<Directory>
�κ�.htaccess
�ļ�������֮����<Location>
��֮ǰ����ע�⣺<Files>
��Ƕ�뵽<Directory>
�����������������õ��ļ�ϵͳ��Χ��
filename����Ӧ����һ���ļ�������һ������ͨ������ַ���������"?
"ƥ���κε����ַ���"*
"ƥ���κ��ַ������С���"~
"�ַ�֮��ͬ������ʹ��������ʽ�����磺
<Files ~ "\.(gif|jpe?g|png)$">
��ƥ����ֳ�����������ͼ���ʽ��Ȼ����Apache1.3�����̰汾�У����Ƽ�ʹ��<FilesMatch>
ָ�
��ע����<Directory>
��<Location>
���öβ�ͬ���ǣ�<Files>
���öο�����.htaccess
�ļ����С��⽫�����û����ļ������Ͽ��ƶ������Լ��ļ��ķ��ʡ�
˵�� | ������������������ʽƥ����ļ�����ָ�� |
---|---|
� | <FilesMatch regex> ... </FilesMatch> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
<FilesMatch>
ָ�����<Files>
ָ��һ���ṩ������ļ����ķ��ʿ��ơ�Ȼ������ʹ�õ���������ʽ������˵��
<FilesMatch "\.(gif|jpe?g|png)$">
��ƥ�������internetͼ���ļ���ʽ��
˵�� | ǿ������ƥ����ļ�����Ϊָ����MIME���ͽ����ŷ� |
---|---|
� | ForceType MIME-type|None |
������ | directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | Apache 2.0֮�������ģ���ƶ��������� |
����ָ�����.htaccess
�ļ���<Directory>
��<Location>
��<Files>
���ö�ʱ����ָ��ǿ������ƥ����ļ���������MIME-type��ָ����Content-Type���ŷ�������˵���������һ����������GIF�ļ���Ŀ¼�������ֲ���ȫ��Ϊ���Ǽ���".gif
"��չ���Ļ�����������������
ForceType image/gif
��ע�⣺��DefaultType
ָ�ͬ����ָ��������е�mime��������������ʶ�ļ����͵���չ����
�����ͨ��ʹ��"None
"�����κ�ForceType
���ã�
# ǿ�������ļ�Ϊ image/gif:
<Location /images>
ForceType image/gif
</Location>
# ����������mime������������:
<Location /images/mixed>
ForceType None
</Location>
˵�� | ���öԿͻ���IP��DNS���� |
---|---|
� | HostnameLookups On|Off|Double |
Ĭ��ֵ | HostnameLookups Off |
������ | server config, virtual host, directory |
״̬ | ����(C) |
ģ�� | core |
��ָ��������DNS��ѯ��ʹ���������ܱ�������־(����REMOTE_HOST
�������ݸ�CGI/SSI)������Double
ָ������һ��˫��DNS��ѯ��Ҳ����˵��һ�η����ѯ֮���ٶԷ��صĽ������һ�������ѯ���������ѯ���������Ӧ����һ��ip��ַ���ʼ�ĵ�ַ�����(��"tcpwrappers"�е�������PARANOID
)
���۴˴�������ã�����ʹ��mod_authz_host
���������������Ʒ��ʵ�ʱ�ͻ�ִ��һ��˫���ѯ�����ȫ��˵�dz���Ҫ����ע�������û������"HostnameLookups Double
"������˫���ѯ�Ľ�������Զ����ɵġ�����˵���������������"HostnameLookups On
"�������������һ�������������������ƵĶ�����˫���ѯ�Ƿ�ʧ�ܣ�CGI���ǻ�ѵ����ѯ�Ľ����REMOTE_HOST
�����͡�
Ĭ��ֵ����Ϊ Off
��Ϊ����Щ����Ҫ���з����ѯ��վ���Լ��������ǵġ���������û�Ҳ������ģ���Ϊ�������ǾͲ������ܲ�ѯ��ɵ��ӳ��ˡ��߷���������վӦ�ý���ָ������Ϊ Off
��ΪDNS��ѯ��������Ե�ʱ�����ġ���bin
Ŀ¼�µ�logresolve
���߿��������ߵ�����¶��Ѿ�������־��IP��ַ�����������IJ�ѯ��
˵�� | ��װһ��ֻ��������ʱ�����Խ��Ϊ��ʱ����Ч��ָ�� |
---|---|
� | <IfDefine [!]parameter-name> ...
</IfDefine> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
<IfDefine test>...</IfDefine>
���ö����ڰ�����������ָ�<IfDefine>
���ö��е�ָ�����test���Ϊ��ʱ�Ž��д������testΪ�١������ö��е�ָ��ᱻ���ԡ�
<IfDefine>
���ö��е�test����Ϊ����������ʽ֮һ��
!
parameter-name�ڵ�һ������£�����parameter-name�Ѿ����������²ŶԿ�ʼ�ͽ������֮���ָ����д����ڶ���������Ȼ�෴������parameter-nameû�����������²Ž���ָ��Ĵ���
parameter-name���ڷ�������ʱ��ͨ��httpd
�����е� -Dparameter
��������ʽָ���ġ�
<IfDefine>
���ö��ǿ���Ƕ�ģ��Ӷ�����ʵ�ּĶ�������ԡ�����˵��
httpd -DReverseProxy ...
# httpd.conf
<IfDefine ReverseProxy>
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/libproxy.so
</IfDefine>
˵�� | ��װָ�����ָ����ģ���Ƿ�����Ϊ�����������Ƿ���д��� |
---|---|
� | <IfModule [!]module-file|module-identifier> ... </IfModule> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
������ | module-identifier���� Apache 2.1 ���Ժ�İ汾�п��� |
<IfModule test>...</IfModule>
���ö����ڷ�װ����ָ����ģ���Ƿ����ö������Ƿ���Ч��ָ���<IfModule>
���ö��е�ָ�����testΪ���ʱ��Ž��д������testΪ�٣���������ָ��������ԡ�
<IfModule>
���е�test����Ϊ�������ַ�ʽ֮һ��
�ڵ�һ������£���ʼ�ͽ������֮���ָ�����module�������ű�ִ�С���ģ�����Ϊ����ʱ��̬���ӽ����ĵ�ģ�����ʹ��LoadModule
ָ�̬�����ģ�顣�ڶ���������෴������moduleû������ʱ�Ž���ָ��Ĵ���
module������ģ��ı�ʶ�������DZ���ģ��ʱ���ļ��������磬rewrite_module
����һ��ģ���ʶ������mod_rewrite.c
���DZ���ģ��ʱ���ļ��������ģ��������Դ�����ļ�����Ӧ��ʹ�ð���STANDARD20_MODULE_STUFF
�ַ������Ǹ���
<IfModule>
���ö��ǿ���Ƕ�ģ��Ӷ�����ʵ�ּĶ�ģ����ԡ�
<IfModule>
���ö��С�˵�� | �ڷ����������ļ��а������������ļ� |
---|---|
� | Include file-path|directory-path |
������ | server config, virtual host, directory |
״̬ | ����(C) |
ģ�� | core |
������ | ͨ������� Apache 2.0.41 ���Ժ�İ汾�п��� |
���ָ�������ڷ����������ļ��м������������ļ���
Shell���(fnmatch()
)��ͨ����������ڰ�����ĸ˳��һ�ΰ�������ļ������⣬���Include
ָ����һ��Ŀ¼������һ���ļ���Apache�������Ŀ¼������Ŀ¼�µ������ļ�����������ĸ˳����Щ�ļ���Ϊ�����ļ����н��������Dz����Ƽ���ô������Ϊż��������ʱ�ļ������Ŀ¼�����ɣ��Ӷ�����httpd
����ʧ�ܡ�
�ļ���·��������һ�������ľ���·��(��һ��б�ܿ�ͷ)��
Include /usr/local/apache2/conf/ssl.conf
Include /usr/local/apache2/conf/vhosts/*.conf
���������ServerRoot
Ŀ¼�����·����
Include conf/ssl.conf
Include conf/vhosts/*.conf
��ȷ��������Ŀ¼�в������κ�����༭����ʱ�ļ����������ļ�����ΪApache�᳢�Զ�ȡ���Dz������е�������Ϊ����ָ���������������ܻᵼ���������̵�ʧ�ܡ����� apachectl configtest
��������ü��ʱ��ʹ�õ������ļ��г����Թ��ο����⽫�����ڼ����������Ƿ������������ϣ��������Щ�ļ���
root@host# apachectl configtest
Processing config file: /usr/local/apache2/conf/ssl.conf
Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf
Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf
Syntax OK
˵�� | ����HTTP�־����� |
---|---|
� | KeepAlive On|Off |
Ĭ��ֵ | KeepAlive On |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
Keep-Alive��չ��HTTP/1.0��HTTP/1.1�ij־��������ԡ��ṩ�˳�Ч��HTTP�Ự��������ͬһ��TCP�����н��ж��������ijЩ����£������ķ�ʽ���������ͼƬ��HTML�ĵ���ɵ���ʱ��50%�ļ������á���Apache1.2�汾�Ժ����������� KeepAlive On
�����ó־����ӡ�
����HTTP/1.0�Ŀͻ�����˵�������ͻ���ָ��ʹ�õ�ʱ��Ż�ʹ�ó־��������ӡ����⣬�����ܹ�Ԥ��֪����������ݳ���ʱ���Ż���HTTP/1.0�Ŀͻ��˽����־��������ӡ�����ζ����Щ���Ȳ��������ݣ�����CGI�����SSIҳ�桢�Լ������������ɵ�Ŀ¼�б������һ����˵����ʹ����HTTP/1.0�ͻ��˽����ij־��������ӡ�������HTTP/1.1�Ŀͻ�����˵�����û�н�������ָ�����־ý���Ĭ�ϵ����ӷ�ʽ������ͻ��˽���������ʹ�÷ֿ�����Խ���ڳ־��������δ֪�������ݵ����⡣
˵�� | �־������з���������������֮��ȴ������� |
---|---|
� | KeepAliveTimeout seconds |
Ĭ��ֵ | KeepAliveTimeout 5 |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
Apache�ڹرճ־�����ǰ�ȴ���һ�������������һ���յ�һ������ʱֵ���ᱻ����ΪTimeout
ָ��ָ����������
���ڸ߸��ɷ�������˵��KeepAliveTimeout
ֵ�ϴ�ᵼ��һЩ���ܷ�������⣺��ʱֵԽ������пͻ��˱������ӵĽ��̾�Խ�ࡣ
˵�� | ����ָ����HTTP�������з��ʿ��� |
---|---|
� | <Limit method [method] ... > ... </Limit> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
���ʿ���һ����˵�Ƕ������ķ��ʷ�������Ч�ģ���Ҳ�������ձ�ϣ���ﵽ��Ч����һ������£����ʿ���ָ�Ӧ�÷���<Limit>
������
<Limit>
ָ���Ŀ�������Ʒ��ʿ��Ƶ�Ч��ʹ���������ijЩHTTP��������������������<Limit>
�����еķ������ƽ������κ������������еķ��ʿ��ƽ�������POST
, PUT
, DELETE
�������������������κ�Ӱ�죺
<Limit POST PUT DELETE>
Require valid-user
</Limit>
�г��ķ�������Ϊ���е�һ��������GET
, POST
, PUT
, DELETE
, CONNECT
, OPTIONS
, PATCH
, PROPFIND
, PROPPATCH
, MKCOL
, COPY
, MOVE
, LOCK
, UNLOCK
���������Ǵ�Сд���е��������GET
�����˶��壬����ͬʱ������HEAD
����TRACE
�������ܱ����ơ�
˵�� | �Գ���ָ���������������HTTP�������з��ʿ��� |
---|---|
� | <LimitExcept method [method] ... > ... </LimitExcept> |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
<LimitExcept>
��</LimitExcept>
���ڷ�װһ����ʿ���ָ�����������������û���ڲ����б����HTTP������Ҳ����˵����<Limit>
�෴�������ڿ��Ʊ��ĺͷDZ��Լ�����ʶ�ķ�����
���磺
<LimitExcept POST GET>
Require valid-user
</LimitExcept>
˵�� | ָ���ڲ��ض����Ƕ���������������� |
---|---|
� | LimitInternalRecursion number [number] |
Ĭ��ֵ | LimitInternalRecursion 10 |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.0.47 ���Ժ�İ汾�п��� |
���磬��ʹ��Action
ָ���ڲ��ض���ԭʼ����һ��CGI�ű�ʱ��һ���ڲ��ض��ᷢ������������Apache��һ�������ҵ����һ��URI������ʱ���ᷢ��ʲô�Ļ��ơ����磬mod_dir
ʹ����������Ѱ����Щ����DirectoryIndex
ָ��Ӧ�����г����ļ���
LimitInternalRecursion
���Է�ֹ����������һ���ڲ��ض���������������ѭ������������������ѭ��ͨ���ɴ������������
���ָ��洢��������ͬ�����ƣ������������ǻ���ÿ��������������м���ġ���һ��number�������ڲ��ض����������(һ����һ��)���ڶ���number����������������Ƕ�ײ����������ָֻ����һ��number ����ô���ᱻͬʱӦ�������������ơ�
LimitInternalRecursion 5
˵�� | ���ƿͻ��˷��͵�HTTP�����������ֽڳ��� |
---|---|
� | LimitRequestBody bytes |
Ĭ��ֵ | LimitRequestBody 0 |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
bytes��0(��ζ��������)��2147483647(2GB)����������������������ֽ�����
LimitRequestBody
�������û��������÷�Χ��(�������������ض�Ŀ¼���ض��ļ����ض�λ��)����һ������ͻ��˷��͵�HTTP�����������ֽڳ��ȵ����ơ�����ͻ��˵�������������ƣ����������Ӧһ������������ŷ��������һ����ͨ�������Ϣ���ںܴ�̶���ȡ������Դ����Ȼ���Ժ������Դ����ķ�����CGI�ű���������Ϣ��ѱ�����Ϣ���ݸ���������ʹ��PUT
�������ٻ���Ҫ������������������Դ�õ�����Ϣ������С��ֵ��
��ָ����˷���������Ա����Ŀɿ����Կ��ƿͻ��˲�������������Ϊ���������ڱ���ijЩ��ʽ�ľܾ�������
���磬����������ļ��ϴ���ij��λ�ã�����ϣ���ܽ��ϴ��ļ��Ĵ�С����Ϊ100K��������ʹ�������ָ�
LimitRequestBody 102400
˵�� | ���ƽ��ܿͻ���������HTTP����ͷ������� |
---|---|
� | LimitRequestFields number |
Ĭ��ֵ | LimitRequestFields 100 |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
Number��һ��0(��ζ�Ų���)��32767֮���������Ĭ��ֵΪ����ʱ�ij���DEFAULT_LIMIT_REQUEST_FIELDS
(����ֵΪ100)��
LimitRequestFields
ָ���������������Ա����һ��HTTP�����е�����ͷ����������ơ���������Ҫ��ֵ����һ����ͨ�ͻ��������а���ͷ���������һ���ͻ�������ͷ����������ٴ���20�������ݿͻ��˵IJ�ͬ��������кܴ�IJ�𣬾���ȡ�����û��������ǵ��������չ��֧�ָ���ϸ������Э�̡���ѡ��HTTP��չ����ʹ������ͷ����ʵ�֡�
���ָ����˷���������Ա����Ŀɿ����Կ��ƿͻ��˲�������������Ϊ���������ڱ���ijЩ��ʽ�ľܾ��������������ʹ�õĿͻ��˵õ��˷������Ĵ���Ӧ��ָ�����������з����˹����ͷ����Ӧ���ʵ��������ֵ��
���磺
LimitRequestFields 50
˵�� | ���ƿͻ��˷��͵�����ͷ���ֽ��� |
---|---|
� | LimitRequestFieldsize bytes |
Ĭ��ֵ | LimitRequestFieldsize 8190 |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
bytesָ����HTTP����ͷ������ֽڴ�С��
LimitRequestFieldSize
ָ���������������Ա���ӻ����HTTP����ͷ���С�����ơ�һ����˵����������Ҫ��ֵ�㹻������Ӧ��ͨ�ͻ��˵��κ������ͷ���С��һ����ͨͷ��Ĵ�С���ڲ�ͬ�Ŀͻ�����˵���кܴ���ģ�һ�����û��������ǵ��������֧�ָ��������Э��������ء�SPNEGO����֤ͷ�����ܴﵽ12392�ֽڡ�
���ָ����˷���������Ա����Ŀɿ����Կ��ƿͻ��˲�������������Ϊ���������ڱ���ijЩ��ʽ�ľܾ�������
�������£�
LimitRequestFieldSize 4094
˵�� | ���ƽ��ܿͻ��˷��͵�HTTP�����е��ֽ��� |
---|---|
� | LimitRequestLine bytes |
Ĭ��ֵ | LimitRequestLine 8190 |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
bytes������HTTP�����е��ֽ������ơ�
LimitRequestLine
ָ���������������Ա���ӻ���ٿͻ���HTTP�����������С�����ơ���Ϊ�����а���HTTP������URI��Э��汾������LimitRequestLine
ָ�����������URI�ij��ȡ�����������Ҫ���ֵ�㹻����װ�������е���Դ��������������GET
�����������ݵIJ�ѯ���ֵ�������Ϣ��
���ָ����˷���������Ա����Ŀɿ����Կ��ƿͻ��˲�������������Ϊ���������ڱ���ijЩ��ʽ�ľܾ�������
�������£�
LimitRequestLine 4094
˵�� | ���ƻ���XML��������Ĵ�С |
---|---|
� | LimitXMLRequestBody bytes |
Ĭ��ֵ | LimitXMLRequestBody 1000000 |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
���ƻ���XML���������С������ֽ�����"0
"��������һ��顣
���磺
LimitXMLRequestBody 0
˵�� | ����װ��ָ��������ƥ���URL |
---|---|
� | <Location
URL-path|URL> ... </Location> |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
<Location>
�ṩ�˻���URL�ķ��ʿ��ơ���<Directory>
ָ�����ƣ���Ҳ������һ����</Location>
��β�����öΡ�<Location>
���öεĴ���λ��<Directory>
, .htaccess
, <Files>
֮�������������ļ��г��ֵ�˳����д���
<Location>
���ö���ȫ�������ļ�ϵͳ֮����������м�����Ҫ�ĺ��������Ҫ����<Location>
������������ļ�ϵͳ�ķ��ʿ��ơ���Ϊ���ܻ��м�����ͬ��URLָ���ļ�ϵͳ�е�ͬһ���ļ������������Ŀ��Ƴ����ᱻ�������ƹ���
<Location>
��ʹ��<Location>
����ָ��Ӧ���ڶ������ļ�ϵͳ֮������ݡ��ļ�ϵͳ֮�ڵ�������ʹ��<Directory>
��<Files>
ָ�����һ��������<Location />
�������Է��������������URL��
�����е�ԭʼ(�Ǵ���)������˵��ƥ���URLӦ���Ǿ���"/path/
"��ʽ��URL·�������������ʷ��������������˿ڻ��ѯ�ַ����ȡ����ڴ��������ƥ���URL����Ϊ"scheme://servername/path
"����ʽ�����ұ������ǰ��
URL������һ��ͨ����ַ���������ͨ����Ĵ���"?
"ƥ���κε������ַ�����"*
"ƥ�������ַ����С�
Ҳ���Ը���"~
"�ַ�����ʾʹ��������ʽ�����磺
<Location ~ "/(extra|special)/data">
��ƥ�����а����ַ���"/extra/data
"��"/special/data
"��URL����Apache1.3��������汾�У�������һ���µ��Ƽ�ʹ�õ�<LocationMatch>
ָ��书����<Location>
��������ʽ�汾��ͬ��
<Location>
��������SetHandler
ָ������ʱ�ܷ������Ч�ܡ���������״̬������������foo.com
���û���Ч������������ʹ�ã�
<Location /status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from .foo.com
</Location>
б���ַ���������URL�г��ֵ�λ�ò�ͬ������������塣��ҿ��ܶ��Ѿ�ϰ�����ļ�ϵͳ�У����������б�ᱻ��Ϊ��һ��б�ߴ���(����"/home///foo
"��"/home/foo
"��ͬ)������URL���棬�������в�ͨ�ġ�<LocationMatch>
ָ���������ʽ�汾��<Location>
Ҫ������ȷʹ�ö���б�ߡ����磺<LocationMatch ^/abc>
��ƥ������"/abc
"������ƥ������"//abc
"������������ʽ�汾��<Location>
ָ�������ڴ�������ʱ��Ҳ�����Ʊ��֡�������������ʽ�汾��<Location>
�����ڷǴ�������ʱ�����Ὣ������ڵ�б����������б�ߡ����磬�����ָ����<Location /abc/def>
��������ָ��"/abc//def
"�ģ���ô���Ǿ���ƥ��ġ�
˵�� | ����װ��ָ��������������ʽƥ���URL |
---|---|
� | <LocationMatch
regex> ... </LocationMatch> |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
<LocationMatch>
��<Location>
ָ����ͬ���ṩ�˻���URL�ķ��ʿ��ơ�����ʹ��������ʽ��Ϊ�����������Ǽ��ַ��������磺
<LocationMatch "/(extra|special)/data">
��ƥ������Ӵ�"/extra/data
"��"/special/data
"��URL��
˵�� | ���ƴ�����־����ϸ�̶� |
---|---|
� | LogLevel level |
Ĭ��ֵ | LogLevel warn |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
LogLevel
���ڵ�����¼�ڴ�����־�е���Ϣ����ϸ�̶ȡ�(�μ�ErrorLog
ָ��)������ѡ������level��������Ҫ�Խ������У�
Level | ���� | ���� |
---|---|---|
emerg | ����(ϵͳ��ʹ��) | "Child cannot open lock file. Exiting" |
alert | ����������ȡ��ʩ | "getpwuid: couldn't determine user name from uid" |
crit | ������� | "socket: Failed to get a socket, exiting child" |
error | ������� | "Premature end of script headers" |
warn | ������� | "child process 1234 did not exit, sending another SIGHUP" |
notice | һ����Ҫ��� | "httpd: caught SIGBUS, attempting to dump core in ..." |
info | ��ͨ��Ϣ | "Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers)..." |
debug | ������Ϣ | "Opening config file ..." |
��ָ����ij������ʱ�����м������������ϢҲ�ᱻͬʱ��¼�����磬ָ�� LogLevel info
��������notice
��warn
�������ϢҲ�ᱻ��¼��
��������ʹ��crit
����
ʾ�����£�
LogLevel notice
��������־��һ�������ֿ�����ʽ�ļ���ʱ��notice
�������Ϣ���ǻᱻ��¼�����������ܱ����Ρ����ǣ���ʹ��syslog
����¼ʱ��û��������⡣
˵�� | һ���־����������������������� |
---|---|
� | MaxKeepAliveRequests number |
Ĭ��ֵ | MaxKeepAliveRequests 100 |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
MaxKeepAliveRequests
ָ�������˵�����KeepAlive
ʱ��ÿ����������������������������ֵ��Ϊ"0
"�����������������Ŀ�����ǽ�����ý���ֵ��Ϊһ���Ƚϴ��ֵ����ȷ�����ŵķ��������ܡ�
���磺
MaxKeepAliveRequests 500
˵�� | Ϊһ��������������������ָ��һ��IP��ַ(�Ͷ˿�) |
---|---|
� | NameVirtualHost addr[:port] |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
�����Ҫ������������������������NameVirtualHost
ָ������������ָ��֮һ��
����addr��������ʹ����������������������ʹ��IP��ַ�����磺
NameVirtualHost 111.22.33.44
ʹ��NameVirtualHost
ָ�������ָ��һ����������������������ʹ���ĸ�IP��ַ������������һ������ǽ�����������������������ת�����������ڵ�����һ��IP��ַ�ϵ�����£�������ָ���ŷ�����Ļ�����������ϵ�IP��ַ����������ڶ����ַʹ���˶������������������������Ӧ��Ϊÿ����ַʹ�����ָ�
"��������"�������"_default_
"�������������ŷ����͵�NameVirtualHost
IP��ַ������(������ָ����NameVirtualHost
����û��Ϊ�����ַָ���κ�VirtualHost
)��
���⣬��������Ϊ��ʹ�õĻ�����������������ָ��һ���˿ںš����磺
NameVirtualHost 111.22.33.44:8080
IPv6��ַ�����װ��һ�Է������ڣ���������ʾ��
NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
Ϊ�˽������н��������������ʹ��"*
"��
NameVirtualHost *
<VirtualHost>
ָ��IJ�����ע�⣬<VirtualHost>
ָ��IJ���������NameVirtualHost
ָ��IJ�����ȫƥ�䡣
NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>
# ...
</VirtualHost>
˵�� | �������ض�Ŀ¼�п���ʹ����Щ���� |
---|---|
� | Options [+|-]option [[+|-]option] ... |
Ĭ��ֵ | Options All |
������ | server config, virtual host, directory, .htaccess |
������ | Options |
״̬ | ����(C) |
ģ�� | core |
Options
ָ����������ض�Ŀ¼�н�ʹ����Щ���������ԡ�
option����ΪNone
������������£����������κζ������ԡ�������Ϊ����ѡ���е�һ��������
All
MultiViews
֮����������ԡ�����Ĭ�����á�ExecCGI
mod_cgi
ִ��CGI�ű���FollowSymLinks
ע�⣺��ʹ��������ʹ�÷������ӣ����������ı�����ƥ��<Directory>
��������
ע�⣺���������λ��<Location>
���ö��У�������ûᱻ������
Includes
mod_include
�ṩ�ķ������˰�����IncludesNOEXEC
#exec cmd
"��"#exec cgi
"�����Կ��Դ�ScriptAlias
Ŀ¼ʹ��"#include virtual
"����CGI�ű���Indexes
DirectoryIndex
(���磺index.html
)����ô�������᷵����mod_autoindex
���ɵ�һ����ʽ�����Ŀ¼�б�MultiViews
mod_negotiation
�ṩ����Э����"������ͼ"(MultiViews)��SymLinksIfOwnerMatch
<Location>
���ö��У���ѡ������ԡ�һ����˵�����һ��Ŀ¼�����������Options
�����������һ���ᱻ��ȫ����(�����ı�����)����������ѡ����趨�˴˲����ں�(�μ����öεĺϲ�)��Ȼ�����������������Options
ָ��Ŀ�ѡ��ǰ������"+
"��"-
"���ţ��˿�ѡ����ϲ�������ǰ�����"+
"�ŵĿ�ѡ�ǿ�Ƹ��ǵ�ǰ�Ŀ�ѡ�����ã�������ǰ����"-
"�ŵĿ�ѡ�ǿ�ƴӵ�ǰ��ѡ��������ȥ����
���磬û���κ�"+
"��"-
"���ţ�
<Directory /web/docs>
Options Indexes FollowSymLinks
</Directory>
<Directory /web/docs/spec>
Options Includes
</Directory>
��ôֻ�н�Includes
���õ�/web/docs/spec
Ŀ¼�ϡ�Ȼ������ڶ���Options
ָ��ʹ����"+
"��"-
"���ţ�
<Directory /web/docs>
Options Indexes FollowSymLinks
</Directory>
<Directory /web/docs/spec>
Options +Includes -Indexes
</Directory>
��ô�ͻ���FollowSymLinks
��Includes
���õ�/web/docs/spec
Ŀ¼�ϡ�
ʹ�� -IncludesNOEXEC
�� -Includes
ʱ������ǰ��������ã�������ȫ���÷������˰�����
û����������ʱ��Ĭ������Ϊ All
��
˵�� | ָ����Щ��֤�û�������ʸ���Դ |
---|---|
� | Require entity-name [entity-name] ... |
������ | directory, .htaccess |
������ | AuthConfig |
״̬ | ����(C) |
ģ�� | core |
���ָ��ָ����Щ��֤�û�������ʸ���Դ����Щ��������Ȩ֧��ģ��ʵ�֡�����£�
Require user userid [userid] ...
Require group group-name [group-name] ...
Require valid-user
�ṩRequire
ָ�����Ȩ֧��ģ���У�mod_authz_user
, mod_authz_groupfile
, mod_authnz_ldap
, mod_authz_dbm
, mod_authz_owner
��
Require
�������AuthName
��AuthType
ָ��Լ�����AuthUserFile
��AuthGroupFile
ָ��(���Զ����û����û���)��ȷ�����ܹ���ȷ���������磺
AuthType Basic
AuthName "Restricted Resource"
AuthUserFile /web/users
AuthGroupFile /web/groups
Require group admin
ʹ�����ַ����ṩ�ķ��ʿ��ƶ�������������Ч������һ������������ﵽ��Ч�����������ϣ����ij���ض��ķ����������ƣ������漰��������ʱ�������Խ�Require
������<Limit>
���ö��С�
���Require
��Allow
��Deny
ָ��ͬʱʹ�ã���ô��Щָ��֮����������Satisfy
ָ����ơ�
���������չʾ�����ʹ��Satisfy
ָ����һ���ܱ�����Ŀ¼�µ���Ŀ¼��ȡ�����ʿ��ơ�ʹ�����ַ�������ʮ��С�ģ���Ϊ��ȡ����mod_authz_host
ʵ�ֵ��κη��ʿ��ơ�
<Directory /path/to/protected/>
Require user david
</Directory>
<Directory /path/to/protected/unprotected>
# ��Ŀ¼�µ�������֤�ͷ��ʿ��ƶ���ȡ����
Satisfy Any
Allow from all
</Directory>
˵�� | ����Apache�ӽ��������Ľ���ռ��CPU��������� |
---|---|
� | RLimitCPU seconds|max [seconds|max] |
Ĭ��ֵ | δ���壬ʹ�ò���ϵͳĬ��ֵ |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
ʹ��һ����������������һ���������������н��̵�����Դ���ƣ��ڶ������������������Դ���ơ�����������������Ϊһ����ֵ����"max
"�Ա�ʾ����Ϊ����ϵͳ��������ֵ���������Դ�������ֵ��Ҫ��root
���з����������ڳ�ʼ����������н������á�
������ƽ�������Apache�ӽ��̷�����������������Ľ��̣�������Apache�ӽ��̱��������Χ����CGI�ű���SSIִ����������������д�Apache�������������Ľ��̡�����ܵ���־��
CPU��Դ���Ʊ�ʾΪÿ����ռ�õ�������
˵�� | ������Apache�ӽ��������Ľ���ռ�õ�����ڴ��ֽ��� |
---|---|
� | RLimitMEM bytes|max [bytes|max] |
Ĭ��ֵ | δ���壬ʹ�ò���ϵͳĬ��ֵ |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
ʹ��һ����������������һ���������������н��̵�����Դ���ƣ��ڶ������������������Դ���ơ�����������������Ϊһ����ֵ����"max
"�Ա�ʾ����Ϊ����ϵͳ��������ֵ���������Դ�������ֵ��Ҫ��root
���з����������ڳ�ʼ����������н������á�
������ƽ�������Apache�ӽ��̷�����������������Ľ��̣�������Apache�ӽ��̱��������Χ����CGI�ű���SSIִ����������������д�Apache�������������Ľ��̡�����ܵ���־��
�ڴ���Դ���Ʊ�ʾΪÿ����ռ�õ��ֽ�����
˵�� | ������Apache�ӽ��������Ľ����������Ľ�����Ŀ |
---|---|
� | RLimitNPROC number|max [number|max] |
Ĭ��ֵ | δ���壬ʹ�ò���ϵͳĬ��ֵ |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
ʹ��һ����������������һ���������������н��̵�����Դ���ƣ��ڶ������������������Դ���ơ�����������������Ϊһ����ֵ����"max
"�Ա�ʾ����Ϊ����ϵͳ��������ֵ���������Դ�������ֵ��Ҫ��root
���з����������ڳ�ʼ����������н������á�
������ƽ�������Apache�ӽ��̷�����������������Ľ��̣�������Apache�ӽ��̱��������Χ����CGI�ű���SSIִ����������������д�Apache�������������Ľ��̡�����ܵ���־��
�������ƿ�����ÿ���û��Ľ�������
���CGI����������web��������uid�����ģ���ô���ָ����Ʒ������Լ��ܹ������Ľ�����Ŀ�������������error_log
����"cannot fork
"���м�¼��
˵�� | ��������ķ��ʿ��ƺ��û���֤֮������ϵ |
---|---|
� | Satisfy Any|All |
Ĭ��ֵ | Satisfy All |
������ | directory, .htaccess |
������ | AuthConfig |
״̬ | ����(C) |
ģ�� | core |
������ | 2.0.51���Ժ�汾����<Limit> ��<LimitExcept> ָ��Ӱ�� |
ͬʱʹ��Allow
��Require
ʱ�ķ��ʲ��ԡ�������������Ϊ All
�� Any
�����ָ�����ij���ض�����ķ��ʿ���ͬʱ���û���/�������ͻ���������ַ��������ʱ�������á�Ĭ����Ϊ(All
)��ȡ�ͻ�������ͨ����ַ������������������Ч���û���������ķ�ʽ��ʹ�ÿ�ѡ�� Any
��ʹ�ͻ�����ͨ���������ƻ�������һ����Ч���û������������ַ�ʽ֮һ�õ�����Ȩ�ޡ��������Ϳ���ͨ������������һ������ķ��ʣ�������ijЩ�ض���ַ�Ŀͻ��˷���ʱ����Ҫ�������롣
���磬������������������ڵ��û���������web��վʱ�������ƣ�������������û����ṩ������ܽ��з��ʣ������Բ�ȡ�������µ����ã�
Require valid-user
Allow from 192.168.1
Satisfy Any
��2.0.51�汾��ʼ��Satisfy
ָ����Ա�������<Limit>
��<LimitExcept>
���ö�ָ�����ض��ķ�����
˵�� | ��λCGI�ű������� |
---|---|
� | ScriptInterpreterSource Registry|Registry-Strict|Script |
Ĭ��ֵ | ScriptInterpreterSource Script |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | ������Win32��Registry-Strict ѡ����� Apache 2.0 ���Ժ�İ汾�п��� |
���ָ�����Apache����ҵ�����CGI�ű��Ľ�������Ĭ��ΪScript
��ʹ���ڽű�����"#!
"��ָ���Ľ���������Win32����һ��ͨ������ȥ��
#!C:/Perl/bin/perl.exe
���ߣ����perl
��λ���Ѿ���PATH
��ָ��������Լ�д�ɣ�
#!perl
����Ϊ ScriptInterpreterSource Registry
��ʹ�ýű��ļ���չ��(����.pl
)��Ϊ�������Windowsע�����HKEY_CLASSES_ROOT
���������� ���������ע����Ӽ�Shell\ExecCGI\Command
��Shell\Open\Command
����(���ǰ�߲�����)��������ҵ���ע����Apache������Ĭ��ֵ��Script
��
�� ScriptInterpreterSource Registry
��ʹ����ScriptAlias
��Ŀ¼һ��ʹ��ʱ��Ҫ�dz�С�ģ���ΪApache��ִ�����Ŀ¼�µ������ļ���Registry
���ÿ��ܻᵼ�¶Բ���ִ���ļ��IJ������ij�����á����磬�ڴ����Windows��Ĭ�ϴ�.htm
�ļ��ij�����IE�������κ�һ���Խű�Ŀ¼��.htm
�ļ��������ڷ�������̨��һ��IE������һ������ķ��������������ڱ����ĺð취��
Registry-Strict
ѡ���Registry
��࣬����ֻʹ��Shell\ExecCGI\Command
�Ӽ���ExecCGI
������һ����ͨ�ļ�����������ע������ֶ����ã��Ӷ����Է�ֹ����ij�����á�
˵�� | ���������ظ��ͻ��˵Ĵ�����Ϣ�а����Ĺ���Ա�ʼ���ַ |
---|---|
� | ServerAdmin email-address|URL |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
ServerAdmin
�����������з��ظ��ͻ��˵Ĵ�����Ϣ�а����Ĺ���Ա�ʼ���ַ�����httpd
���ܽ��ṩ�IJ���ʶ��ΪURL�����ͻ�ٶ�����һ��email-address �����ڳ�����������mailto:
���档�Ƽ�ʹ��һ��Email��ַ����Ϊ���CGI�ű���������Ϊ�ġ������ȷʵ��ʹ��URL��һ��Ҫ��ָ֤��һ�����ܹ����Ƶķ������������û�����ȷ��һ�����Ժ���ȡ����ϵ��
Ϊ���Ŀ��ר������һ��������ֵ�õģ����磺
ServerAdmin www-admin@foo.example.com
��Ϊ�û�һ�㲻��ע����������۷����������⣡
˵�� | ƥ��һ���������������������ı��� |
---|---|
� | ServerAlias hostname [hostname] ... |
������ | virtual host |
״̬ | ����(C) |
ģ�� | core |
ServerAlias
ָ���趨�����ı�����������������������������
<VirtualHost *>
ServerName server.domain.com
ServerAlias server server2.domain.com server2
# ...
</VirtualHost>
˵�� | ���������ڱ�ʶ�Լ����������Ͷ˿ں� |
---|---|
� | ServerName fully-qualified-domain-name[:port] |
������ | server config, virtual host |
״̬ | ����(C) |
ģ�� | core |
������ | ��2.0���У����ָ�������1.3���Port ָ��Ĺ��� |
ServerName
ָ�������˷��������ڱ�ʶ�Լ����������Ͷ˿ںš�����Ҫ���ڴ����ض���URL�����磬һ������web��������������Ϊsimple.example.com
����ͬʱ��һ��DNS����www.example.com
������ϣ��web������������һ�㣬������ʹ�����µ�ָ�
ServerName www.example.com:80
��û��ָ��ServerName
ʱ���������᳢�Զ�IP��ַ���з����ѯ���ƶ��������������ServerName
��û��ָ���˿ںţ���������ʹ�ý���������Ǹ��˿ڡ�Ϊ�˼�ǿ�ɿ��ԺͿ�Ԥ���ԣ���Ӧ��ʹ��ServerName
��ʽ��ָ��һ���������Ͷ˿ںš�
���ʹ�õ�������������������������<VirtualHost>
���е�ServerName
����Ϊ��ƥ�����������������"Host:
"����ͷ�б�����ֵ���������
�μ�UseCanonicalName
��UseCanonicalPhysicalPort
ָ���Ի�ù���������URL(����ʹ��mod_dir
ģ��)����Ҫָ��һ���ض��˿ڣ�����ʹ�ÿͻ�������Ķ˿ںŵĸ���ϸ����Ϣ��
˵�� | Ϊ�����Բ��õ���������ʻ�����������������������URL·���� |
---|---|
� | ServerPath URL-path |
������ | virtual host |
״̬ | ����(C) |
ģ�� | core |
ServerPath
ָ��Ϊ���������˱��ص�(legacy)URL·���������ں����������������������ʹ�á�
˵�� | ��װ�������Ļ���Ŀ¼ |
---|---|
� | ServerRoot directory-path |
Ĭ��ֵ | ServerRoot /usr/local/apache |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
ServerRoot
ָ�������˷��������ڵ�Ŀ¼��һ����˵��������conf/
��logs/
��Ŀ¼�����������ļ������·�������ڴ�Ŀ¼ (����Include
��LoadModule
)��
ServerRoot /home/httpd
httpd
�� -d
ѡ��ServerRoot
Ȩ�IJ���˵�� | ���÷���������ҳ���ҳ�� |
---|---|
� | ServerSignature On|Off|EMail |
Ĭ��ֵ | ServerSignature Off |
������ | server config, virtual host, directory, .htaccess |
������ | All |
״̬ | ����(C) |
ģ�� | core |
ServerSignature
ָ�����������÷������������ĵ���ҳ��(������Ϣ��mod_proxy
��ftpĿ¼�б�mod_info
�����)�����������ҳ�ŵ�ԭ����Ҫ���ڴ���һ��������������е�ʱ���û���������ʶ�����������е��ĸ����������������˷��صĴ�����Ϣ��
Ĭ�ϵ� Off
����û�д�����(��������Apache1.2�����ɰ汾����)������ On
�������һ�й��ڷ������汾�������ŷ�������������ServerName
���� EMail
���û����ĵ���˵�����������ⴴ��һ��ָ��ServerAdmin
��"mailto:"���֡�
����2.0.44�Ժ�İ汾����ʾ����ϸ�������汾�Ž���ServerTokens
ָ����ơ�
˵�� | ����"Server: "Ӧ��ͷ |
---|---|
� | ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full |
Ĭ��ֵ | ServerTokens Full |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
���ָ������˷�������Ӧ���ͻ��˵�"Server:
"Ӧ��ͷ�Ƿ�������ڷ���������ϵͳ���ͺͱ������ģ��������Ϣ��
ServerTokens Prod[uctOnly]
Server: Apache
ServerTokens Major
Server: Apache/2
ServerTokens Minor
Server: Apache/2.0
ServerTokens Min[imal]
Server: Apache/2.0.41
ServerTokens OS
Server: Apache/2.0.41 (Unix)
ServerTokens Full
(��δָ��)Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2
�����ý����������������������Ҳ��������������������ö��С�
2.0.44�汾�Ժ����ָ�������ServerSignature
ָ�����ʾ���ݡ�
˵�� | ǿ������ƥ����ļ���һ��ָ���Ĵ��������� |
---|---|
� | SetHandler handler-name|None |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
������ | ��Apache2.0��������� |
�����ָ�����.htaccess
��<Directory>
��<Location>
���ö���ʱ�����ָ�ǿ������ƥ����ļ�ͨ��handler-nameָ�����������������磺����벻��ij��Ŀ¼�е��ļ�����ʲô��չ������������Ϊͼ��ӳ������ļ��������������Խ����������Ǹ�Ŀ¼��.htaccess
�У�
SetHandler imap-file
����һ�����ӣ�������뵱http://servername/status
������ʱ����������ʾһ��״̬���棬�����Խ������������httpd.conf
���棺
<Location /status>
SetHandler server-status
</Location>
�����ͨ��ʹ�� None
����дһ�����ȶ����SetHandler
ָ�
˵�� | ���ô���ͻ��������POST����ʱʹ�õĹ����� |
---|---|
� | SetInputFilter filter[;filter...] |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
SetInputFilter
ָ��Ϊ���������ܲ�����ͻ��������POST���������˹������������������ط�(����AddInputFilter
ָ��)���õĹ��������⸽�ӵĹ�������
��������˶���һ�������������DZ��밴�մ������ݵ�˳���÷ֺ�(;)�ָ���
˵�� | �������ڴ�����������Ӧ��Ĺ����� |
---|---|
� | SetOutputFilter filter[;filter...] |
������ | server config, virtual host, directory, .htaccess |
������ | FileInfo |
״̬ | ����(C) |
ģ�� | core |
SetOutputFilter
ָ�������������ڷ�����Ӧ���͵��ͻ���֮ǰʹ�õĹ������������������ط�(����AddOutputFilter
ָ��)���õĹ��������⸽�ӵĹ�������
���磺�������ý����/www/data/
Ŀ¼�µ������ļ���ΪSSI�ļ�������
<Directory /www/data/>
SetOutputFilter INCLUDES
</Directory>
��������˶���һ�������������DZ��밴�մ������ݵ�˳���÷ֺ�(;)�ָ���
˵�� | �������ڶ϶�����ʧ��ǰ�ȴ������� |
---|---|
� | TimeOut seconds |
Ĭ��ֵ | TimeOut 300 |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
TimeOut
ָ����������Apache�ȴ����������¼���ʱ�䳤�ȣ�
���Ǽƻ��ڷ�չ����У������Ƿֱ��ø������á���ʱ����1.2�汾֮ǰ��Ĭ��ֵΪ1200���������Ѿ�����Ϊ300�ˣ������ھ�����������˵�����㹻�ġ�û�а���Ĭ��ֵ��ĸ�С��ԭ�����ڴ����ﻹ�е����⣺��ʱ����һ����֮��ʱ��û�и�λ��
˵�� | ȷ����δ���TRACE ���� |
---|---|
� | TraceEnable [on|off|extended] |
Ĭ��ֵ | TraceEnable on |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 1.3.34, 2.0.55 ���Ժ�İ汾�п��� |
���ָ��ͬʱ�����˺��ĺ�mod_proxy
ģ����δ���TRACE
����Ĭ��(TraceEnable on
)������RFC2616����Ľ�ֹ�����κ��������TRACE
����TraceEnable off
��ʹ���ĺ�mod_proxy
ģ����ͻ��˷���һ��"405
"(��ֹ�ķ���)����
���Ϊ�˲��Ժ���ϣ���������"TraceEnable extended
"�������������塣����(ԭʼ������)���Ὣ�������С����Ϊ64k����(���ʹ���� Transfer-Encoding: chunked
ͷ��������ΪHTTPͷ����8k)�����Ļ�ͬʱ����Ӧ��ͷ��Ӧ���壻�����������û�ж����������64k�����ơ�
˵�� | ���÷��������ȷ�����Լ��������Ͷ˿� |
---|---|
� | UseCanonicalName On|Off|DNS |
Ĭ��ֵ | UseCanonicalName Off |
������ | server config, virtual host, directory |
״̬ | ����(C) |
ģ�� | core |
�ںܶ�����£�Apache���빹��һ��������URL(��һ��ָ����ͬ��������URL)��ʹ�� UseCanonicalName On
�ὫServerName
���������������������URL��SERVER_NAME
��CGI�е�SERVER_PORT
��
����Ϊ UseCanonicalName Off
ʱ������ͻ����ṩ���������Ͷ˿�(������������ʹ�ñ�����)��Apache����ʹ����Щ��Ϣ������������URL����Щֵ������ʵ����������������������ֵ��ͬ�����Ҷ���ͬ���Ŀͻ��˿��á�CGI����SERVER_NAME
��SERVER_PORT
Ҳ���ɿͻ����ṩ��ֵ��������
�������ķ�ʽ�ɹ����������������£���һ���������ڣ������������������û�ʹ������www
�����Ķ��������з��ʡ�����ע�������û�����������http://www/splat
�����Ķ�������Ŀ¼��URL������û������б����Apache�Ὣ�����ض���http://www.domain.com/splat/
������������Ŀ¼�������������֤����ᵼ���û��������������֤��һ�����www
������һ�����www.domain.com
(�μ����ڴ������FAQ��ø�����Ϣ)�������UseCanonicalName
��Ϊ Off
��Apache�ͻ��ض���http://www/splat/
��
��������ѡ���� UseCanonicalName DNS
������Ϊ��������IP����������֧����Щ�Ŷ����IJ��ṩ"Host:
"ͷ�������ʹ�á�ʹ�����ѡ��ʱ��Apache���Կͻ�������ķ�������IP��ַ���з���DNS��ѯ���Թ���������URL��
���CGI��SERVER_NAME
��ֵ�����˼ٶ������ǻᱻ��ѡ���ƻ����ͻ��˶��ڸ���������Ҫ���������������ж�����ȫ�������Ƶġ������CGI��ʹ��SERVER_NAME
�����������õ�URL�����ǻṤ���ĺܺá�
˵�� | ���÷��������ȷ���Լ������ֺͶ˿� |
---|---|
� | UseCanonicalPhysicalPort On|Off |
Ĭ��ֵ | UseCanonicalPhysicalPort Off |
������ | server config, virtual host, directory |
״̬ | ����(C) |
ģ�� | core |
������ | ���� Apache 2.2.0 ���Ժ�İ汾�п��� |
�ںܶ�����£�Apache���빹��һ��������URL(��һ��ָ����ͬ��������URL)���� UseCanonicalPhysicalPort On
��ʱ��Apache���п����ڹ���������Ĺ淶�˿�ʱΪ�˷���UseCanonicalName
ָ���ʹ��ʵ�ʵ�����˿ں�(physical port)���� UseCanonicalPhysicalPort Off
��ʱ��Apache������ʹ��ʵ�ʵ�����˿ںţ��������������Ѿ����õ���Ϣ������һ���Ϸ��Ķ˿ںš�
����ʹ������˿ںŵĴ������£�
UseCanonicalName On
Servername
ָ���Ķ˿ں�UseCanonicalName Off | DNS
Host:
"����ͷ�ṩ�Ķ˿ں�Servername
ָ���Ķ˿ں��� UseCanonicalPhysicalPort Off
������£�����˿ںŽ��������˳��������
˵�� | ������������ָ����������IP��ַ��ָ�� |
---|---|
� | <VirtualHost addr[:port] [addr[:port]] ...> ... </VirtualHost> |
������ | server config |
״̬ | ����(C) |
ģ�� | core |
<VirtualHost>
��</VirtualHost>
���ڷ�װһ����������ض�����������ָ��κ����������������п���ʹ�õ�ָ��Ҳͬ������������ʹ�á���������������һ���ض������������ĵ�����ʱ������ʹ�÷�װ��<VirtualHost>
���ö��е�ָ�Addr�����ǣ�
*
"������"NameVirtualHost *
"���ʹ����ƥ�����е�IP��ַ_default_
"�������IP���������������Բ�������û��ƥ���IP��ַ
<VirtualHost 10.1.2.3>
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>
IPv6�ĵ�ַ������뷽������ָ����������Ϊ��ѡ��Ķ˿ںŽ���ȷ����һ��IPv6��ʾ�����£�
<VirtualHost [2001:db8::a00:20ff:fea7:ccea]>
ServerAdmin webmaster@host.example.com
DocumentRoot /www/docs/host.example.com
ServerName host.example.com
ErrorLog logs/host.example.com-error_log
TransferLog logs/host.example.com-access_log
</VirtualHost>
ÿ���������������Ӧ��ͬ��IP��ַ���˿ںŻ��Dz�ͬ�����������ڵ�һ������£����������ڵ����������������Ϊ����Ϊ���IP��ַ����IP����(�ڻ���û�ж������Ӳ�����������£�������IJ���ϵͳ֧�֣�������ʹ�� ifconfig alias
�������ﵽ���Ŀ��)��
<VirtualHost>
��ʹ�ò���Ӱ��Apache�ļ�����ַ������Ҫʹ��Listen
��ȷ��Apache���ڼ�����ȷ�ĵ�ַ��
��ʹ�û���IP����������ʱ�����������"_default_
"������û��ƥ�䵽�����г��������������������Ϊƥ���κ�IP��ַ��Ĭ��������������û�н���"_default_
"�����������趨ʱ����û��IP������ƥ�������£���ʹ��"��������"(�����������������ö�֮��)�����á�����ע�⣺�κ�ƥ��NameVirtualHost
ָ���IP��ַ�Ȳ���ʹ��"��������"���ã�Ҳ����ʹ��"_default_
"�������������á��μ��������������������ĵ���
������ָ��һ��":port
"���ı�ƥ��Ķ˿ڡ����û��ָ��������������������������������Ǹ�Listen
ָ����ֵ����Ҳ����ָ��":*
"��ƥ���Ǹ���ַ�ϵ����ж˿�(����ʹ��"_default_
"ʱ�������Ƽ����õķ���)��
�μ���ȫ��ʾ�ĵ��Ի��Ϊʲô�����洢��־�ļ���Ŀ¼��������������������û���˵�ǿ�д�Ļ�Σ����������ȫ����ϸ���ϡ�