分享

APACHE中 httpd.conf 的中文详解

 心之所指 2006-01-04

APACHE中 httpd.conf 的中文详解




ServerRoot "/Apache" 
#可以用绝对路径 e:\web\apache 
#ServerRoot用于指定守护进程httpd的运行目录,httpd在启动之后将自动将进程的当前目录改变为这个目录,因此如果设置文件中指定的文件或目录是相对路径,那么真实路径就位于这个ServerRoot定义的路径之下。 

PidFile logs/httpd.pid 
#PidFile指定的文件将记录httpd守护进程的进程号,由于httpd能自动复制其自身,因此系统中有多个httpd进程,但只有一个进程为最初启动的进程,它为其他进程的父进程,对这个进程发送信号将影响所有的httpd进程。PidFILE定义的文件中就记录httpd父进程的进程号 

Timeout 300 
#Timeout定义客户程序和服务器连接的超时间隔,超过这个时间间隔(秒)后服务器将断开与客户机的连接. 

KeepAlive On 
#在HTTP 1.0中,一次连接只能作传输一次HTTP请求,而KeepAlive参数用于支持HTTP 1.1版本的一次连接、多次传输功能,这样就可以在一次连接中传递多个HTTP请求。虽然只有较新的浏览器才支持这个功能,但还是打开使用这个选项 

MaxKeepAliveRequests 100 
#MaxKeepAliveRequests为一次连接可以进行的HTTP请求的最大请求次数。将其值设为0将支持在一次连接内进行无限次的传输请求。事实上没有客户程序在一次连接中请求太多的页面,通常达不到这个上限就完成连接了。 

KeepAliveTimeout 15 
#KeepAliveTimeout测试一次连接中的多次请求传输之间的时间,如果服务器已经完成了一次请求,但一直没有接收到客户程序的下一次请求,在间隔超过了这个参数设置的值之后,服务器就断开连接。 

<IfModule mpm_winnt.c> 
ThreadsPerChild 250 
MaxRequestsPerChild  0 
</IfModule> 

Listen 80 
#端口,启动模块.下面许多模块只有在LIUNX下才有用 
LoadModule access_module modules/mod_access.so 
LoadModule actions_module modules/mod_actions.so 
LoadModule alias_module modules/mod_alias.so 
LoadModule asis_module modules/mod_asis.so 
LoadModule auth_module modules/mod_auth.so 
LoadModule dir_module modules/mod_dir.so 
LoadModule cgi_module modules/mod_cgi.so 
LoadModule mime_module modules/mod_mime.so 
LoadModule log_config_module modules/mod_log_config.so 
LoadModule autoindex_module modules/mod_autoindex.so 
LoadModule negotiation_module modules/mod_negotiation.so 
LoadModule setenvif_module modules/mod_setenvif.so 

#LoadModule cern_meta_module modules/mod_cern_meta.so 
#LoadModule env_module modules/mod_env.so 
#LoadModule expires_module modules/mod_expires.so 
#LoadModule file_cache_module modules/mod_file_cache.so 
#LoadModule headers_module modules/mod_headers.so 
#LoadModule imap_module modules/mod_imap.so 

#LoadModule auth_anon_module modules/mod_auth_anon.so 
#LoadModule auth_dbm_module modules/mod_auth_dbm.so 
#LoadModule auth_digest_module modules/mod_auth_digest.so 
#LoadModule dav_module modules/mod_dav.so 
#LoadModule dav_fs_module modules/mod_dav_fs.so 
#LoadModule include_module modules/mod_include.so 
#LoadModule info_module modules/mod_info.so 
#LoadModule isapi_module modules/mod_isapi.so 
#LoadModule mime_magic_module modules/mod_mime_magic.so 
#LoadModule proxy_module modules/mod_proxy.so 
#LoadModule proxy_connect_module modules/mod_proxy_connect.so 
#LoadModule proxy_http_module modules/mod_proxy_http.so 
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so 
#LoadModule speling_module modules/mod_speling.so 
#LoadModule status_module modules/mod_status.so 
#LoadModule unique_id_module modules/mod_unique_id.so 
#LoadModule usertrack_module modules/mod_usertrack.so 
#LoadModule ssl_module modules/mod_ssl.so 

#LoadModule vhost_alias_module modules/mod_vhost_alias.so 
#LoadModule userdir_module modules/mod_userdir.so 
LoadModule rewrite_module modules/mod_rewrite.so 

#ExtendedStatus On 

ServerAdmin abc@123.com 
#服务器管理员邮箱,在出错,探针中显示 

ServerName localhost.domain.com 

UseCanonicalName Off 
#是否允许对每个访问者的 DNS 域名的反向查询 

DocumentRoot "/Apache" 
#放网页的目录.这个很重要. 
#你设置了,e:\web是目录 而虚拟主机设置了e:\webtwo 
#虽然程序还是能运行,但是不在documentroot内的话,程序会有错误 
<Directory /> 
   Options FollowSymLinks MultiViews ExecCGI 
   AllowOverride None 
</Directory> 

<Directory "/Apache/"> 
   Options FollowSymLinks MultiViews ExecCGI 
   AllowOverride None 
   Order allow,deny 
   php_admin_value open_basedir /apache/ 
   Allow from all 
</Directory> 
#以下是关于用户目录配置部分,即用户可以用http://www./~username的方式来访问自已的网站! 
#UserDir /apache/webroot/aaausersfreehost/*/public_html 
#<Directory e:/虚拟主机/*/public_html> 
#    AllowOverride None 
#    Options MultiViews SymLinksIfOwnerMatch IncludesNoExec ExecCGI 
#下面这条指令定义php只能对public_html此目录及其子目录下的文件进行操作. 
#    php_flag engine off   #表示此目录下的PHP文件不被解释执行,限没有PHP权限。        
#    php_admin_value open_basedir ./ 
#    Order allow,deny 
#    Allow from all 
#</Directory> 
#下面这条指令可以把虚拟目录freehost映射到实际路径/apache/webroot/users/下! 
#AliasMatch ^/class/([0-9]).html$ /article.php?articleid= 
#AliasMatch ^/class/([0-9]+).([0-9a-zA-Z]+)\.html$ /article.php?articleid=&pagenum= 

DirectoryIndex index.html index.htm index.php index.cgi bbs.pl index.pl admin.php login.htm login.html login.php 
#默然主机头 
AccessFileName .htaccess 

<Files ~ "^\.ht"> 
   Order allow,deny 
   Deny from all 
</Files> 

TypesConfig conf/mime.types 

DefaultType text/plain 

<IfModule mod_mime_magic.c> 
   MIMEMagicFile conf/magic 
</IfModule> 


#以下是限制主机同时并发连接数 
#<IfModule prefork.c> 
#ServerLimit 2000 
#StartServers 15 
#MinSpareServers 15 
#MaxSpareServers 20 
#MaxClients 850    #最大客户端 
#MaxRequestsPerChild 10000  #最大请求数 
#</IfModule> 

#以下是对单个文件进行访问控制 
#<Files ~ "要屏蔽的文件的名称"> 
#Order allow,deny 
#Allow from 允许IP 
#Deny from all 
#</Files> 

HostnameLookups Off 

#EnableMMAP off 

#EnableSendfile off 

ErrorLog logs/error.log 

LogLevel warn 



LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 
LogFormat "%h %l %u %t \"%r\" %>s %b" common 
LogFormat "%{Referer}i -> %U" referer 
LogFormat "%{User-agent}i" agent 

CustomLog logs/access.log common 

#CustomLog logs/referer.log referer 
#CustomLog logs/agent.log agent 
#CustomLog logs/access.log combined 

ServerTokens Full 

ServerSignature Off 
#当客户请求的网页并不存在时,服务器将产生错误文档,缺省情况下由于打开了 ServerSignature选项,错误文档的最后一行将包含服务器的名字、Apache的版本等信息。 

#Alias /class/ "/apache/webroot/phpa"     #虚拟目录啦 
#    <Directory /apache/phpsafe>       #对虚拟目录进行权限配置 
#    Options FollowSymLinks            #+MultiViews ExecCGI为有CGI执行权限 
#    php_admin_value safe_mode 1       #表示此目录下的PHP脚本只能有php_safe下权限 
#    php_admin_value open_basedir /apache/phpsafe/ 
#   此句是限制PHP的文件操作只能限于/apache/phpsafe及其子目录下,不能对此目录外的文进行操作 
#    php_flag engine off                
#表示此目录下的PHP脚本不会被解释执行,此选项要求PHP必须以模块方式安装的! 
#    AllowOverride None 
#    Order allow,deny 
#    Allow from all                    #表示允许任何人从任何地方访问 
#   </Directory> 

#ScriptAlias /cgi-bin/ "E:/Apache2/cgi-bin/" 
#<Directory "E:/Apache2/cgi-bin"> 
#    AllowOverride None 
#    Options None 
#    Order allow,deny 
#    Allow from all 
#</Directory> 

IndexOptions FancyIndexing VersionSort 

#AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip 
#AddIconByType (TXT,/icons/text.gif) text/* 
#AddIconByType (IMG,/icons/image2.gif) image/* 
#AddIconByType (SND,/icons/sound2.gif) audio/* 
#AddIconByType (VID,/icons/movie.gif) video/* 

#AddIcon /icons/binary.gif .bin .exe 
#AddIcon /icons/binhex.gif .hqx 
#AddIcon /icons/tar.gif .tar 
#AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv 
#AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip 
#AddIcon /icons/a.gif .ps .ai .eps 
#AddIcon /icons/layout.gif .html .shtml .htm .pdf 
#AddIcon /icons/text.gif .txt 
#AddIcon /icons/c.gif .c 
#AddIcon /icons/p.gif .pl .py 
#AddIcon /icons/f.gif .for 
#AddIcon /icons/dvi.gif .dvi 
#AddIcon /icons/uuencoded.gif .uu 
#AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl 
#AddIcon /icons/tex.gif .tex 
#AddIcon /icons/bomb.gif core 

#AddIcon /icons/back.gif .. 
#AddIcon /icons/hand.right.gif README 
#AddIcon /icons/folder.gif ^^DIRECTORY^^ 
#AddIcon /icons/blank.gif ^^BLANKICON^^ 
#DefaultIcon /icons/unknown.gif 

AddDescription "GZIP compressed document" .gz 
AddDescription "tar archive" .tar 
AddDescription "GZIP compressed tar archive" .tgz 

ReadmeName README.html 
HeaderName HEADER.html 
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t 

AddEncoding x-compress Z 
AddEncoding x-gzip gz tgz 

AddLanguage ca .ca 
AddLanguage cs .cz .cs 
AddLanguage da .dk 
AddLanguage de .de 
AddLanguage el .el 
AddLanguage en .en 
AddLanguage eo .eo 
AddLanguage es .es 
AddLanguage et .et 
AddLanguage fr .fr 
AddLanguage he .he 
AddLanguage hr .hr 
AddLanguage it .it 
AddLanguage ja .ja 
AddLanguage ko .ko 
AddLanguage ltz .ltz 
AddLanguage nl .nl 
AddLanguage nn .nn 
AddLanguage no .no 
AddLanguage pl .po 
AddLanguage pt .pt 
AddLanguage pt-BR .pt-br 
AddLanguage ru .ru 
AddLanguage sv .sv 
AddLanguage zh-CN .zh-cn 
AddLanguage zh-TW .zh-tw 

LanguagePriority  zh-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-TW 

ForceLanguagePriority Prefer Fallback 

#AddDefaultCharset ISO-8859-1 
AddDefaultCharset GB2312 

AddCharset ISO-8859-1  .iso8859-1 .latin1 
AddCharset ISO-8859-2  .iso8859-2 .latin2 .cen 
AddCharset ISO-8859-3  .iso8859-3 .latin3 
AddCharset ISO-8859-4  .iso8859-4 .latin4 
AddCharset ISO-8859-5  .iso8859-5 .latin5 .cyr .iso-ru 
AddCharset ISO-8859-6  .iso8859-6 .latin6 .arb 
AddCharset ISO-8859-7  .iso8859-7 .latin7 .grk 
AddCharset ISO-8859-8  .iso8859-8 .latin8 .heb 
AddCharset ISO-8859-9  .iso8859-9 .latin9 .trk 
AddCharset ISO-2022-JP .iso2022-jp .jis 
AddCharset ISO-2022-KR .iso2022-kr .kis 
AddCharset ISO-2022-CN .iso2022-cn .cis 
AddCharset Big5        .Big5       .big5 
# For russian, more than one charset is used (depends on client, mostly): 
AddCharset WINDOWS-1251 .cp-1251   .win-1251 
AddCharset CP866       .cp866 
AddCharset KOI8-r      .koi8-r .koi8-ru 
AddCharset KOI8-ru     .koi8-uk .ua 
AddCharset ISO-10646-UCS-2 .ucs2 
AddCharset ISO-10646-UCS-4 .ucs4 
AddCharset UTF-8       .utf8 

AddCharset GB2312      .gb2312 .gb 
AddCharset utf-7       .utf7 
AddCharset utf-8       .utf8 
AddCharset big5        .big5 .b5 
AddCharset EUC-TW      .euc-tw 
AddCharset EUC-JP      .euc-jp 
AddCharset EUC-KR      .euc-kr 
AddCharset shift_jis   .sjis 

#以CGI方式安装PHP 
#ScriptAlias "/__php_dir__/" "/apache/cgiphp5/" 
#AddType application/x-httpd-php .php4 .php .htm .php3 .inc .fire 
#Action application/x-httpd-php "/__php_dir__/php.exe" 

#以apache的模块方式运行php 
LoadModule php4_module /apache/php/sapi/php4apache.dll 
PHPINIDir /apache/php/php.ini 
AddType application/x-httpd-php .php .htm .php3 
AddType application/x-httpd-php-source .phps 

#支持fcgi 
#LoadModule fastcgi_module modules/mod_fastcgi.dll   
#AddHandler fastcgi-script .fcgi .fpl 

AddType application/x-tar .tgz 

#AddEncoding x-compress .Z 
#AddEncoding x-gzip .gz .tgz 

AddType application/x-compress .Z 
AddType application/x-gzip .gz .tgz 

AddHandler cgi-script .cgi .pl 


#AddHandler send-as-is asis 

#AddHandler imap-file map 

AddHandler type-map var 


#AddType text/html .shtml 
#AddOutputFilter INCLUDES .shtml 

#ErrorDocument 500 "The server made a boo boo." 
#ErrorDocument 404 /apache/yyfzx/soft 
#ErrorDocument 404 "/apache/yyfzx/soft" 
#ErrorDocument 402 http://www./subscription_info.html 


BrowserMatch "Mozilla/2" nokeepalive 
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 
BrowserMatch "RealPlayer 4\.0" force-response-1.0 
BrowserMatch "Java/1\.0" force-response-1.0 
BrowserMatch "JDK/1\.0" force-response-1.0 

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully 
BrowserMatch "^WebDrive" redirect-carefully 
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully 
BrowserMatch "^gnome-vfs" redirect-carefully 

#<Location /server-status> 
#    SetHandler server-status 
#    Order deny,allow 
#    Deny from all 
#    Allow from .51web.net 
#</Location> 

#<Location /server-info> 
#    SetHandler server-info 
#    Order deny,allow 
#    Deny from all 
#    Allow from .51web.net 
#</Location> 


<IfModule mod_ssl.c> 
   Include conf/ssl.conf 
</IfModule> 

#以下是关于虚拟机的配置 
NameVirtualHost 218.87.169.209:80 
<VirtualHost 218.87.169.209:80> 
  RewriteEngine On 
  RewriteRule ^/index.htm$ /index.php 
  RewriteRule ^/soft/([0-9]+).htm$ /download.php?soft= 
  RewriteRule ^/sort/([0-9-_]+).htm$ /list.php?list= 
  RewriteRule ^/sort/index.htm$ /type.php 
  RewriteRule ^/a-z/([0-9]+).htm$ /az.php?id= 
  DocumentRoot /apache/mayidown 
  ServerName mayidown.3322.org 
</VirtualHost> 
//以 #开头的就是解释用.启动的时候不加载的.我提供了一个虚拟主机给大家参考重写URL功能 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多