`
moqiang02
  • 浏览: 530278 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
文章分类
社区版块
存档分类
最新评论

Apache 配置文件详解

 
阅读更多
### Section 1: Global Environment
//当服务器响应主机头(header)信息时显示Apache的版本和操作系统名称
ServerTokens OS
//设置服务器的根目录
ServerRoot "/etc/httpd"

#ScoreBoardFile run/httpd.scoreboard

//设置运行Apache时使用的PidFile的路径
PidFile run/httpd.pid

//若300秒后没有收到或送出任何数据就切断该连接
Timeout 300

//不使用保持连接的功能,即客户一次请求连接只能响应一个文件
/建议用户将此参数的值设置为On,即允许使用保持连接的功能
KeepAlive Off

//在使用保持连接功能时,设置客户一次请求连接能响应文件的最大上限
MaxKeepAliveRequests 100

//在使用保持连接功能时,两个相邻的连接的时间间隔超过15秒,就切断连接
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
//设置使用Prefork MPM运行方式的参数,此运行方式是Red hat默认的方式
<IfModule prefork.c>

//设置服务器启动时运行的进程数
StartServers<wbr><wbr><wbr><wbr>8<br><br> //Apache在运行时会根据负载的轻重自动调整空闲子进程的数目<br> //若存在低于5个空闲子进程,就创建一个新的子进程准备为客户提供服务<br> MinSpareServers<wbr><wbr>5<br><br> //若存在高于20个空闲子进程,就创建逐一删除子进程来提高系统性能<br> MaxSpareServers<wbr><wbr>20<br><br> //限制同一时间的连接数不能超过150<br> MaxClients<wbr><wbr><wbr><wbr>150<br><br> //限制每个子进程在结束处理请求之前能处理的连接请求为1000<br> MaxRequestsPerChild 1000<br> &lt;/IfModule&gt;<br><br> # worker MPM<br> # StartServers: initial number of server processes to start<br> //设置使用Worker MPM运行方式的参数<br> &lt;IfModule worker.c&gt;<br> StartServers<wbr><wbr><wbr><wbr>2<br> MaxClients<wbr><wbr><wbr><wbr>150<br> MinSpareThreads<wbr><wbr>25<br> MaxSpareThreads<wbr><wbr>75<br> ThreadsPerChild<wbr><wbr>25<br> MaxRequestsPerChild 0<br> &lt;/IfModule&gt;<br><br> # perchild MPM<br> # NumServers: constant number of server processes<br> //设置使用perchild MPM运行方式的参数<br> &lt;IfModule perchild.c&gt;<br> NumServers<wbr><wbr><wbr><wbr>5<br> StartThreads<wbr><wbr><wbr><wbr>5<br> MinSpareThreads<wbr><wbr><wbr><wbr>5<br> MaxSpareThreads<wbr><wbr>10<br> MaxThreadsPerChild 20<br> MaxRequestsPerChild 0<br> &lt;/IfModule&gt;<br><br> //设置服务器的监听端口<br> #Listen 12.34.56.78:80<br> Listen 202.112.85.101:80<br><br> #<br> # Load config files from the config directory "/etc/httpd/conf.d".<br> //将/etc/httpd/conf.d目录下所有以conf结尾的配置文件包含进来<br> Include conf.dpublic_html&gt;<br> #<wbr><wbr>AllowOverride FileInfo AuthConfig Limit<br> #<wbr><wbr>Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec<br> #<wbr><wbr>&lt;Limit GET POST OPTIONS&gt;<br> #<wbr><wbr><wbr><wbr>Order allow,deny<br> #<wbr><wbr><wbr><wbr>Allow from all<br> #<wbr><wbr>&lt;/Limit&gt;<br> #<wbr><wbr>&lt;LimitExcept GET POST OPTIONS&gt;<br> #<wbr><wbr><wbr><wbr>Order deny,allow<br> #<wbr><wbr><wbr><wbr>Deny from all<br> #<wbr><wbr>&lt;/LimitExcept&gt;<br> #&lt;/Directory&gt;<br><br> //当访问服务器时,依次查找页面Index.html index.htm.var<br> DirectoryIndex index.html index.html.var<br><br> //指定保护目录配置文件的名称<br> AccessFileName .htaccess<br><br> //拒绝访问以.ht开头的文件,即保证.htaccess不被访问<br> &lt;Files ~ "^.ht"&gt;<br> Order allow,deny<br> Deny from all<br> &lt;/Files&gt;<br><br> //指定负责处理MIME对应格式的配置文件的存放位置<br> TypesConfig /etc/mime.types<br> //指定默认的MIME文件类型为纯文本或HTML文件<br> DefaultType text/plain<br><br> //当mod_mime_magic.c模块被加载时,指定magic信息码配置文件的存放位置<br> &lt;IfModule mod_mime_magic.c&gt;<br> #<wbr><wbr>MIMEMagicFile /usr/share/magic.mime<br> MIMEMagicFile conf/magic<br> &lt;/IfModule&gt;<br><br> //只记录连接Apache服务器的Ip地址,而不纪录主机名<br> HostnameLookups Off<br> //指定错误<a target="_blank" href="http://hi.baidu.com/go_status/blog/item/:;" style="text-decoration:none; color:rgb(89,100,133)"><u><strong>日志</strong></u></a>存放位置<br> ErrorLog logs/error_log<br> //指定记录的错误信息的详细等级为warn等级<br> LogLevel warn<br> //定义四中记录日志的格式<br> LogFormat "%h %l %u %t "%r" %&gt;s %b "%{ Referer }i" "%{ User-Agent }i"" combined<br> LogFormat "%h %l %u %t "%r" %&gt;s %b" common<br> LogFormat "%{ Referer }i -&gt; %U" referer<br> LogFormat "%{ User-agent }i" agent<br><br> //指定访问日志的纪录格式为combined(混合型),并指定访问日志存放位置<br> # CustomLog logs/access_log common<br> CustomLog logs/access_log combined<br> #CustomLog logs/referer_log referer<br> #CustomLog logs/agent_log agent<br> #CustomLog logs/access_log combined<br><br> //设置apache自己产生的页面中使用apache服务器版本的签名<br> ServerSignature On<br><br> //设置内容协商目录的访问别名<br> Alias /icons/ "/var/www/icons/"<br> //设置/var/www/icons/的访问权限<br> &lt;Directory "/var/www/icons"&gt;<br> //MultiViews 使用内容协商功决定被发送的网页的性质<br> Options Indexes MultiViews<br> AllowOverride None<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;<br><br> //设置网页邮件服务<br> Alias /webmail "/usr/share/squirrelmail"<br><br> &lt;Directory "/usr/share/squirrelmail"&gt;<br> Options Indexes MultiViews<br> AllowOverride None<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;<br><br> //设置apache手册的访问别名<br> Alias /manual "/var/www/manual"<br><br> &lt;Directory "/var/www/manual"&gt;<br> Options Indexes FollowSymLinks MultiViews<br> AllowOverride None<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
//指定DAV加锁数据库文件的存放位置
<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb
</IfModule>

Alias /docs<wbr><wbr>"/home/EMU/webmail/docs/"<br><br> &lt;Directory "/home/EMU/webmail/docs"&gt;<br> Options Indexes FollowSymLinks MultiViews<br> AllowOverride None<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;<br><br> &lt;IfModule mod_dav_fs.c&gt;<br> # Location of the WebDAV lock database.<br> DAVLockDB /var/lib/dav/lockdb<br> &lt;/IfModule&gt;<br><br> //设置CGI目录的访问别名<br> scrīptAlias /cgi-bin/ "/var/www/cgi-bin/"<br><br> //由于red hat中不使用worker MPM运行方式,所以不加载mod_cgid.c模块<br> &lt;IfModule mod_cgid.c&gt;<br> #<br> # Additional to mod_cgid.c settings, mod_cgid has scrīptsock &lt;path&gt;<br> # for setting UNIX socket for communicating with cgid.<br> #<br> #scrīptsock<wbr><wbr><wbr><wbr><wbr><wbr>logs/cgisock<br> &lt;/IfModule&gt;<br><br> //设置CGI目录的访问权限<br> &lt;Directory "/var/www/cgi-bin"&gt;<br> AllowOverride None<br> Options None<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;<br><br> //重定向连接<br> # Redirect permanent /foo<a target="_blank" href="http://www.example.com/bar" style="text-decoration:none; color:rgb(89,100,133)">http://www.example.com/bar</a><br><br> //设置自动生成目录列表的显示方式<br> //FancyIndexing 对每种类型的文件前加上一个小图标以示区别<br> //VersionSort 对同一个软件的多个版本进行排序<br> //NameWidth=* 文件名字段自动适应当前目录下的最长文件名<br> IndexOptions FancyIndexing VersionSort NameWidth=*<br><br> //当使用IndexOptions FancyIndexing之后,配置下面的参数<br> //用于告知服务器在遇到不同的文件类型或扩展名时采用MIME编码格式<br> //辨别文件类型并显示相应的图标<br> AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip<br><br> AddIconByType (TXT,/icons/text.gif) text/*<br> AddIconByType (IMG,/icons/image2.gif) image/*<br> AddIconByType (SND,/icons/sound2.gif) audio/*<br> AddIconByType (VID,/icons/movie.gif) video/*<br><br> //当使用IndexOptions FancyIndexing之后,配置下面的参数<br> //用于告知服务器在遇到不同的文件类型或扩展名时采用所指定的格式<br> //并显示相应的图标<br> AddIcon /icons/binary.gif .bin .exe<br> AddIcon /icons/binhex.gif .hqx<br> AddIcon /icons/tar.gif .tar<br> AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv<br> AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip<br> AddIcon /icons/a.gif .ps .ai .eps<br> AddIcon /icons/layout.gif .html .shtml .htm .pdf<br> AddIcon /icons/text.gif .txt<br> AddIcon /icons/c.gif .c<br> AddIcon /icons/p.gif .pl .py<br> AddIcon /icons/f.gif .for<br> AddIcon /icons/dvi.gif .dvi<br> AddIcon /icons/uuencoded.gif .uu<br> AddIcon /icons/scrīpt.gif .conf .sh .shar .csh .ksh .tcl<br> AddIcon /icons/tex.gif .tex<br> AddIcon /icons/bomb.gif core<br><br> AddIcon /icons/back.gif ..<br> AddIcon /icons/hand.right.gif README<br> AddIcon /icons/folder.gif ^^DIRECTORY^^<br> AddIcon /icons/blank.gif ^^BLANKICON^^<br><br><br> //当使用IndexOptions FancyIndexing之后,且无法识别文件类型时<br> //显示此处定义的图标<br> DefaultIcon /icons/unknown.gif<br><br> #<br> # AddDescrīption allows you to place a short descrīption after a file in<br> # server-generated indexes. These are only displayed for FancyIndexed<br> # directories.<br> # Format: AddDescrīption "descrīption" filename<br> #<br> #AddDescrīption "GZIP compressed document" .gz<br> #AddDescrīption "tar archive" .tar<br> #AddDescrīption "GZIP compressed tar archive" .tgz<br><br> //当服务器自动列出目录列表时,在所生成的页面之后显示readme.html的内容<br> ReadmeName README.html<br> //当服务器自动列出目录列表时,在所生成的页面之前显示header.html的内容<br> HeaderName HEADER.html<br><br> #<br> # IndexIgnore is a set of filenames which directory indexing should ignore<br> # and not include in the listing. Shell-style wildcarding is permitted.<br> #<br> IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t<br><br> //设置在线浏览用户可以实时解压缩.z<wbr><wbr>.gz<wbr><wbr>.tgz类型的文件<br> //并非所有浏览器都支持<br> AddEncoding x-compress Z<br> AddEncoding x-gzip gz tgz<br><br><br> #<br> # DefaultLanguage nl<br> # Danish (da) - Dutch (nl) -<a target="_blank" href="http://hi.baidu.com/go_status/blog/item/:;" style="text-decoration:none; color:rgb(89,100,133)"><u><strong>English</strong></u></a>(en) - Estonian (et)<br> # French (fr) - German (de) - Greek-Modern (el)<br> # Italian (it) - Norwegian (no) - Norwegian Nynorsk (nn) - Korean (kr)<br> # Portugese (pt) - Luxembourgeois* (ltz)<br> # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz)<br> # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)<br> # Russian (ru) - Croatian (hr)<br> #<br> //设置网页内容的语言种类(浏览器要启用内容协商)<br> //对中文网页,此项无实际意义<br> AddLanguage da .dk<br> AddLanguage nl .nl<br> AddLanguage en .en<br> AddLanguage et .et<br> AddLanguage fr .fr<br> AddLanguage de .de<br> AddLanguage he .he<br> AddLanguage el .el<br> AddLanguage it .it<br> AddLanguage ja .ja<br> AddLanguage pl .po<br> AddLanguage kr .kr<br> AddLanguage pt .pt<br> AddLanguage nn .nn<br> AddLanguage no .no<br> AddLanguage pt-br .pt-br<br> AddLanguage ltz .ltz<br> AddLanguage ca .ca<br> AddLanguage es .es<br> AddLanguage sv .se<br> AddLanguage cz .cz<br> AddLanguage ru .ru<br> AddLanguage tw .tw<br> AddLanguage zh-tw .tw<br> AddLanguage hr .hr<br><br> //当启用内容协商时,设置语言的先后顺序<br> LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ltz ca es sv tw<br><br> //Prefer 当有多种语言可以匹配时,使用LanguagePriority 列表的第一项<br> //Fallback 当没有语言可以匹配时,使用LanguagePriority 列表的第一项<br> ForceLanguagePriority Prefer Fallback<br><br> //设置默认字符集<br> AddDefaultCharset ISO-8859-1<br><br> //设置各种字符集<br> AddCharset ISO-8859-1 .iso8859-1 .latin1<br> AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen<br> AddCharset ISO-8859-3 .iso8859-3 .latin3<br> AddCharset ISO-8859-4 .iso8859-4 .latin4<br> AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru<br> AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb<br> AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk<br> AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb<br> AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk<br> AddCharset ISO-2022-JP .iso2022-jp .jis<br> AddCharset ISO-2022-KR .iso2022-kr .kis<br> AddCharset ISO-2022-CN .iso2022-cn .cis<br> AddCharset Big5<wbr><wbr><wbr><wbr>.Big5<wbr><wbr><wbr><wbr>.big5<br> # For russian, more than one charset is used (depends on client, mostly):<br> AddCharset WINDOWS-1251 .cp-1251<wbr><wbr>.win-1251<br> AddCharset CP866<wbr><wbr><wbr><wbr>.cp866<br> AddCharset KOI8-r<wbr><wbr><wbr><wbr>.koi8-r .koi8-ru<br> AddCharset KOI8-ru<wbr><wbr>.koi8-uk .ua<br> AddCharset ISO-10646-UCS-2 .ucs2<br> AddCharset ISO-10646-UCS-4 .ucs4<br> AddCharset UTF-8<wbr><wbr><wbr><wbr>.utf8<br><br> # The set below does not map to a specific (iso) standard<br> # but works on a fairly wide range of browsers. Note that<br> # capitalization actually matters (it should not, but it<br> # does for some browsers).<br> #<br> # See<a target="_blank" href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets" style="text-decoration:none; color:rgb(89,100,133)">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</a><br> # for a list of sorts. But browsers support few.<br> #<br> AddCharset GB2312<wbr><wbr><wbr><wbr>.gb2312 .gb<br> AddCharset utf-7<wbr><wbr><wbr><wbr>.utf7<br> AddCharset utf-8<wbr><wbr><wbr><wbr>.utf8<br> AddCharset big5<wbr><wbr><wbr><wbr>.big5 .b5<br> AddCharset EUC-TW<wbr><wbr><wbr><wbr>.euc-tw<br> AddCharset EUC-JP<wbr><wbr><wbr><wbr>.euc-jp<br> AddCharset EUC-KR<wbr><wbr><wbr><wbr>.euc-kr<br> AddCharset shift_jis<wbr><wbr>.sjis<br><br> //添加新的MIME类型(避免用户编辑/etc/mime.types)<br> AddType application/x-tar .tgz<br><br><br> #<br> # AddHandler allows you to map certain file extensions to "handlers":<br> # actions unrelated to filetype. These can be either built into the server<br> # or added with the Action directive (see below)<br> #<br> # To use CGI scrīpts outside of scrīptAliased directories:<br> # (You will also need to add "ExecCGI" to the "Options" directive.)<br> #<br> #AddHandler cgi-scrīpt .cgi<br><br> #<br> # For files that include their own HTTP headers:<br> #<br> #AddHandler send-as-is asis<br><br> //设置apcche对某些扩展名的处理方式<br> AddHandler imap-file map<br> AddHandler type-map var<br><br> //使用过滤器执行SSI<br> AddOutputFilter INCLUDES .shtml<br><br> //设置错误页面目录的别名<br> Alias /error/ "/var/www/error/"<br><br> &lt;IfModule mod_negotiation.c&gt;<br> &lt;IfModule mod_include.c&gt;<br> &lt;Directory "/var/www/error"&gt;<br> AllowOverride None<br> Options IncludesNoExec<br> AddOutputFilter Includes html<br> AddHandler type-map var<br> Order allow,deny<br> Allow from all<br> LanguagePriority en es de fr<br> ForceLanguagePriority Prefer Fallback<br> &lt;/Directory&gt;<br> //设置错误输出页面<br> ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var<br> ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var<br> ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var<br> ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var<br> ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var<br> ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var<br> ErrorDocument 410 /error/HTTP_GONE.html.var<br> ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var<br> ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var<br> ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var<br> ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var<br> ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var<br> ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var<br> ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var<br> ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var<br> ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var<br> ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var<br><br> &lt;/IfModule&gt;<br> &lt;/IfModule&gt;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
//设置浏览器匹配
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

#
# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your-domain.com" to match your domain to enable.
#
#<Location /server-status>
#<wbr><wbr>SetHandler server-status<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Location&gt;<br><br> #<br> # Allow remote server configuration reports, with the URL of<br> # http://servername/server-info (requires that mod_info.c be loaded).<br> # Change the ".your-domain.com" to match your domain to enable.<br> #<br> #&lt;Location /server-info&gt;<br> #<wbr><wbr>SetHandler server-info<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Location&gt;<br><br> //设置APache为代理服务器<br> # Proxy Server directives. Uncomment the following lines to<br> # enable the proxy server:<br> #<br> #&lt;IfModule mod_proxy.c&gt;<br> #ProxyRequests On<br> #<br> #&lt;Proxy *&gt;<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Proxy&gt;<br><br> #<br> # Enable/disable the handling of HTTP/1.1 "Via:" headers.<br> # ("Full" adds the server version; "Block" removes all outgoing Via: headers)<br> # Set to one of: Off | On | Full | Block<br> #<br> #ProxyVia On<br><br> #<br> # To enable the cache as well, edit and uncomment the following lines:<br> # (no cacheing without CacheRoot)<br> #<br> #CacheRoot "/etc/httpd/proxy"<br> #CacheSize 5<br> #CacheGcInterval 4<br> #CacheMaxExpire 24<br> #CacheLastModifiedFactor 0.1<br> #CacheDefaultExpire 1<br> #NoCache a-domain.com another-domain.edu joes.garage-sale.com<br><br> #&lt;/IfModule&gt;<br> # End of proxy directives.<br><br> //设置虚拟主机<br> ### Section 3: Virtual Hosts<br> #<br> # VirtualHost: If you want to maintain multiple domains/hostnames on your<br> # machine you can setup VirtualHost containers for them. Most configurations<br> # use only name-based virtual hosts so the server doesn't need to worry about<br> # IP addresses. This is indicated by the asterisks in the directives below.<br> #<br> # Please see the documentation at<br> # &lt;URL:<a target="_blank" href="http://httpd.apache.org/docs-2.0/vhosts/" style="text-decoration:none; color:rgb(89,100,133)">http://httpd.apache.org/docs-2.0/vhosts/</a>&gt;<br> # for further details before you try to setup virtual hosts.<br> #<br> # You may use the command line option '-S' to verify your virtual host<br> # configuration.<br><br> #<br> # Use name-based virtual hosting.<br> //指令监听本地计算机上所有的IP地址请求<br> #NameVirtualHost *<br><br> #<br> # VirtualHost example:<br> # Almost any Apache directive may go into a VirtualHost container.<br> # The first VirtualHost section is used for requests without a known<br> # server name.<br> #<br> #&lt;VirtualHost *&gt;<br> //定义虚拟主机的设置,此设置将覆盖前面有的的相同指令<br> #<wbr><wbr>ServerAdmin webmaster at dummy-host dot example.com<br> #<wbr><wbr>DocumentRoot /www/docs/dummy-host.example.com<br> #<wbr><wbr>ServerName dummy-host.example.com<br> #<wbr><wbr>ErrorLog logs/dummy-host.example.com-error_log<br> #<wbr><wbr>CustomLog logs/dummy-host.example.com-access_log common<br> #&lt;/VirtualHost&gt;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
//设置浏览器匹配
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

#
# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your-domain.com" to match your domain to enable.
#
#<Location /server-status>
#<wbr><wbr>SetHandler server-status<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Location&gt;<br><br> #<br> # Allow remote server configuration reports, with the URL of<br> # http://servername/server-info (requires that mod_info.c be loaded).<br> # Change the ".your-domain.com" to match your domain to enable.<br> #<br> #&lt;Location /server-info&gt;<br> #<wbr><wbr>SetHandler server-info<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Location&gt;<br><br> //设置APache为代理服务器<br> # Proxy Server directives. Uncomment the following lines to<br> # enable the proxy server:<br> #<br> #&lt;IfModule mod_proxy.c&gt;<br> #ProxyRequests On<br> #<br> #&lt;Proxy *&gt;<br> #<wbr><wbr>Order deny,allow<br> #<wbr><wbr>Deny from all<br> #<wbr><wbr>Allow from .your-domain.com<br> #&lt;/Proxy&gt;<br><br> #<br> # Enable/disable the handling of HTTP/1.1 "Via:" headers.<br> # ("Full" adds the server version; "Block" removes all outgoing Via: headers)<br> # Set to one of: Off | On | Full | Block<br> #<br> #ProxyVia On<br><br> #<br> # To enable the cache as well, edit and uncomment the following lines:<br> # (no cacheing without CacheRoot)<br> #<br> #CacheRoot "/etc/httpd/proxy"<br> #CacheSize 5<br> #CacheGcInterval 4<br> #CacheMaxExpire 24<br> #CacheLastModifiedFactor 0.1<br> #CacheDefaultExpire 1<br> #NoCache a-domain.com another-domain.edu joes.garage-sale.com<br><br> #&lt;/IfModule&gt;<br> # End of proxy directives.<br><br> //设置虚拟主机<br> ### Section 3: Virtual Hosts<br> #<br> # VirtualHost: If you want to maintain multiple domains/hostnames on your<br> # machine you can setup VirtualHost containers for them. Most configurations<br> # use only name-based virtual hosts so the server doesn't need to worry about<br> # IP addresses. This is indicated by the asterisks in the directives below.<br> #<br> # Please see the documentation at<br> # &lt;URL:<a target="_blank" href="http://httpd.apache.org/docs-2.0/vhosts/" style="text-decoration:none; color:rgb(89,100,133)">http://httpd.apache.org/docs-2.0/vhosts/</a>&gt;<br> # for further details before you try to setup virtual hosts.<br> #<br> # You may use the command line option '-S' to verify your virtual host<br> # configuration.<br><br> #<br> # Use name-based virtual hosting.<br> //指令监听本地计算机上所有的IP地址请求<br> #NameVirtualHost *<br><br> #<br> # VirtualHost example:<br> # Almost any Apache directive may go into a VirtualHost container.<br> # The first VirtualHost section is used for requests without a known<br> # server name.<br> #<br> #&lt;VirtualHost *&gt;<br> //定义虚拟主机的设置,此设置将覆盖前面有的的相同指令<br> #<wbr><wbr>ServerAdmin webmaster at dummy-host dot example.com<br> #<wbr><wbr>DocumentRoot /www/docs/dummy-host.example.com<br> #<wbr><wbr>ServerName dummy-host.example.com<br> #<wbr><wbr>ErrorLog logs/dummy-host.example.com-error_log<br> #<wbr><wbr>CustomLog logs/dummy-host.example.com-access_log common<br> #&lt;/VirtualHost&gt;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics