mirror of
https://github.com/apache/httpd.git
synced 2025-08-13 14:40:20 +00:00
Backporting syntax highlighting (and a few typo fixes) for base directory files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1334033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -71,25 +71,25 @@
|
|||||||
<p>For example, to make the server accept connections on both
|
<p>For example, to make the server accept connections on both
|
||||||
port 80 and port 8000, on all interfaces, use:</p>
|
port 80 and port 8000, on all interfaces, use:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Listen 80<br />
|
Listen 80
|
||||||
Listen 8000
|
Listen 8000
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>To make the server accept connections on port 80 for one interface,
|
<p>To make the server accept connections on port 80 for one interface,
|
||||||
and port 8000 on another, use</p>
|
and port 8000 on another, use</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Listen 192.0.2.1:80<br />
|
Listen 192.0.2.1:80
|
||||||
Listen 192.0.2.5:8000
|
Listen 192.0.2.5:8000
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>IPv6 addresses must be enclosed in square brackets, as in the
|
<p>IPv6 addresses must be enclosed in square brackets, as in the
|
||||||
following example:</p>
|
following example:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Listen [2001:db8::a00:20ff:fea7:ccea]:80
|
Listen [2001:db8::a00:20ff:fea7:ccea]:80
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<note type="warning"><p>Overlapping <directive
|
<note type="warning"><p>Overlapping <directive
|
||||||
module="mpm_common">Listen</directive> directives will result in a
|
module="mpm_common">Listen</directive> directives will result in a
|
||||||
@ -136,10 +136,10 @@
|
|||||||
<directive module="mpm_common">Listen</directive> directives, as in the
|
<directive module="mpm_common">Listen</directive> directives, as in the
|
||||||
following examples:</p>
|
following examples:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Listen 0.0.0.0:80<br />
|
Listen 0.0.0.0:80
|
||||||
Listen 192.0.2.1:80
|
Listen 192.0.2.1:80
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>If your platform supports it and you want httpd to handle IPv4 and
|
<p>If your platform supports it and you want httpd to handle IPv4 and
|
||||||
IPv6 connections on separate sockets (i.e., to disable IPv4-mapped
|
IPv6 connections on separate sockets (i.e., to disable IPv4-mapped
|
||||||
@ -162,9 +162,9 @@
|
|||||||
<p>You only need to set the protocol if you are running on non-standard
|
<p>You only need to set the protocol if you are running on non-standard
|
||||||
ports. For example, running an <code>https</code> site on port 8443:</p>
|
ports. For example, running an <code>https</code> site on port 8443:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Listen 192.170.2.1:8443 https
|
Listen 192.170.2.1:8443 https
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="virtualhost">
|
<section id="virtualhost">
|
||||||
|
@ -430,12 +430,12 @@ Vary: negotiate,accept-language,accept-charset
|
|||||||
|
|
||||||
<p>Typically the module will be configured as so;</p>
|
<p>Typically the module will be configured as so;</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
CacheRoot /var/cache/apache/<br />
|
CacheRoot "/var/cache/apache/"
|
||||||
CacheEnable disk /<br />
|
CacheEnable disk /
|
||||||
CacheDirLevels 2<br />
|
CacheDirLevels 2
|
||||||
CacheDirLength 1
|
CacheDirLength 1
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>Importantly, as the cached files are locally stored, operating system
|
<p>Importantly, as the cached files are locally stored, operating system
|
||||||
in-memory caching will typically be applied to their access also. So
|
in-memory caching will typically be applied to their access also. So
|
||||||
@ -663,9 +663,9 @@ CacheDirLength 1
|
|||||||
instructs httpd to open the file when it is started and to re-use
|
instructs httpd to open the file when it is started and to re-use
|
||||||
this file-handle for all subsequent access to this file.</p>
|
this file-handle for all subsequent access to this file.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
CacheFile /usr/local/apache2/htdocs/index.html
|
CacheFile /usr/local/apache2/htdocs/index.html
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>If you intend to cache a large number of files in this manner, you
|
<p>If you intend to cache a large number of files in this manner, you
|
||||||
must ensure that your operating system's limit for the number of open
|
must ensure that your operating system's limit for the number of open
|
||||||
@ -755,9 +755,9 @@ sys 0m0.000s</pre>
|
|||||||
start time (using the mmap system call). httpd will use the in-memory
|
start time (using the mmap system call). httpd will use the in-memory
|
||||||
contents for all subsequent accesses to this file.</p>
|
contents for all subsequent accesses to this file.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
MMapFile /usr/local/apache2/htdocs/index.html
|
MMapFile /usr/local/apache2/htdocs/index.html
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>As with the
|
<p>As with the
|
||||||
<directive module="mod_file_cache">CacheFile</directive> directive, any
|
<directive module="mod_file_cache">CacheFile</directive> directive, any
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
defines a file suffix as <code>type-map</code>; this is best done
|
defines a file suffix as <code>type-map</code>; this is best done
|
||||||
with</p>
|
with</p>
|
||||||
|
|
||||||
<example>AddHandler type-map .var</example>
|
<highlight language="config">AddHandler type-map .var</highlight>
|
||||||
|
|
||||||
<p>in the server configuration file.</p>
|
<p>in the server configuration file.</p>
|
||||||
|
|
||||||
@ -223,7 +223,7 @@
|
|||||||
module="mod_dir">DirectoryIndex</directive> directive, if the
|
module="mod_dir">DirectoryIndex</directive> directive, if the
|
||||||
server is trying to index a directory. If the configuration files
|
server is trying to index a directory. If the configuration files
|
||||||
specify</p>
|
specify</p>
|
||||||
<example>DirectoryIndex index</example>
|
<highlight language="config">DirectoryIndex index</highlight>
|
||||||
<p>then the server will arbitrate between <code>index.html</code>
|
<p>then the server will arbitrate between <code>index.html</code>
|
||||||
and <code>index.html3</code> if both are present. If neither
|
and <code>index.html3</code> if both are present. If neither
|
||||||
are present, and <code>index.cgi</code> is there, the server
|
are present, and <code>index.cgi</code> is there, the server
|
||||||
@ -512,8 +512,10 @@
|
|||||||
the normal negotiation process applies.</p>
|
the normal negotiation process applies.</p>
|
||||||
|
|
||||||
<example><title>Example</title>
|
<example><title>Example</title>
|
||||||
SetEnvIf Cookie "language=(.+)" prefer-language=$1<br />
|
<highlight language="config">
|
||||||
Header append Vary cookie
|
SetEnvIf Cookie "language=(.+)" prefer-language=$1
|
||||||
|
Header append Vary cookie
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
@ -55,19 +55,19 @@
|
|||||||
if <directive module="core">AllowOverride</directive> is set to
|
if <directive module="core">AllowOverride</directive> is set to
|
||||||
FileInfo.</p>
|
FileInfo.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
ErrorDocument 500 "Sorry, our script crashed. Oh dear"<br />
|
ErrorDocument 500 "Sorry, our script crashed. Oh dear"<br />
|
||||||
ErrorDocument 500 /cgi-bin/crash-recover<br />
|
ErrorDocument 500 /cgi-bin/crash-recover<br />
|
||||||
ErrorDocument 500 http://error.example.com/server_error.html<br />
|
ErrorDocument 500 http://error.example.com/server_error.html<br />
|
||||||
ErrorDocument 404 /errors/not_found.html <br />
|
ErrorDocument 404 /errors/not_found.html <br />
|
||||||
ErrorDocument 401 /subscription/how_to_subscribe.html
|
ErrorDocument 401 /subscription/how_to_subscribe.html
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>The syntax of the <code>ErrorDocument</code> directive is:</p>
|
<p>The syntax of the <code>ErrorDocument</code> directive is:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
ErrorDocument <3-digit-code> <action>
|
ErrorDocument <3-digit-code> <action>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>where the action will be treated as:</p>
|
<p>where the action will be treated as:</p>
|
||||||
|
|
||||||
@ -96,7 +96,7 @@
|
|||||||
'REDIRECT_' onto the original header name. This provides the error
|
'REDIRECT_' onto the original header name. This provides the error
|
||||||
document the context of the original request.</p>
|
document the context of the original request.</p>
|
||||||
|
|
||||||
<p>For example, you might recieve, in addition to more usual
|
<p>For example, you might receive, in addition to more usual
|
||||||
environment variables, the following.</p>
|
environment variables, the following.</p>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<p>If you point your <code>ErrorDocument</code> to some variety of
|
<p>If you point your <code>ErrorDocument</code> to some variety of
|
||||||
dynamic handler such as a server-side include document, CGI
|
dynamic handler such as a server-side include document, CGI
|
||||||
script, or some variety of other handler, you may wish to use the
|
script, or some variety of other handler, you may wish to use the
|
||||||
available custom environent variables to customize this
|
available custom environment variables to customize this
|
||||||
response.</p>
|
response.</p>
|
||||||
|
|
||||||
<p>If the ErrorDocument specifies a local redirect to a CGI
|
<p>If the ErrorDocument specifies a local redirect to a CGI
|
||||||
|
@ -37,13 +37,13 @@
|
|||||||
<section id="example">
|
<section id="example">
|
||||||
<title>A Simple Example</title>
|
<title>A Simple Example</title>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
# This is a misconfiguration example, do not use on your server <br />
|
# This is a misconfiguration example, do not use on your server
|
||||||
<VirtualHost www.example.dom> <br />
|
<VirtualHost www.example.dom>
|
||||||
ServerAdmin webgirl@example.dom <br />
|
ServerAdmin webgirl@example.dom
|
||||||
DocumentRoot /www/example <br />
|
DocumentRoot /www/example
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>In order for the server to function properly, it absolutely needs
|
<p>In order for the server to function properly, it absolutely needs
|
||||||
to have two pieces of information about each virtual host: the
|
to have two pieces of information about each virtual host: the
|
||||||
@ -59,13 +59,13 @@
|
|||||||
<p>Suppose that <code>www.example.dom</code> has address 192.0.2.1.
|
<p>Suppose that <code>www.example.dom</code> has address 192.0.2.1.
|
||||||
Then consider this configuration snippet:</p>
|
Then consider this configuration snippet:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
# This is a misconfiguration example, do not use on your server <br />
|
# This is a misconfiguration example, do not use on your server
|
||||||
<VirtualHost 192.0.2.1> <br />
|
<VirtualHost 192.0.2.1>
|
||||||
ServerAdmin webgirl@example.dom <br />
|
ServerAdmin webgirl@example.dom
|
||||||
DocumentRoot /www/example <br />
|
DocumentRoot /www/example
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>This time httpd needs to use reverse DNS to find the
|
<p>This time httpd needs to use reverse DNS to find the
|
||||||
<code>ServerName</code> for this virtualhost. If that reverse
|
<code>ServerName</code> for this virtualhost. If that reverse
|
||||||
@ -78,13 +78,13 @@
|
|||||||
|
|
||||||
<p>Here is a snippet that avoids both of these problems:</p>
|
<p>Here is a snippet that avoids both of these problems:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<VirtualHost 192.0.2.1> <br />
|
<VirtualHost 192.0.2.1>
|
||||||
ServerName www.example.dom <br />
|
ServerName www.example.dom
|
||||||
ServerAdmin webgirl@example.dom <br />
|
ServerAdmin webgirl@example.dom
|
||||||
DocumentRoot /www/example <br />
|
DocumentRoot /www/example
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="denial">
|
<section id="denial">
|
||||||
@ -92,21 +92,16 @@
|
|||||||
|
|
||||||
<p>Consider this configuration snippet:</p>
|
<p>Consider this configuration snippet:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<VirtualHost www.example1.dom><br />
|
<VirtualHost www.example1.dom>
|
||||||
<indent>
|
ServerAdmin webgirl@example1.dom
|
||||||
ServerAdmin webgirl@example1.dom<br />
|
DocumentRoot /www/example1
|
||||||
DocumentRoot /www/example1<br />
|
</VirtualHost>
|
||||||
</indent>
|
<VirtualHost www.example2.dom>
|
||||||
</VirtualHost><br />
|
ServerAdmin webguy@example2.dom
|
||||||
<br />
|
DocumentRoot /www/example2
|
||||||
<VirtualHost www.example2.dom><br />
|
</VirtualHost>
|
||||||
<indent>
|
</highlight>
|
||||||
ServerAdmin webguy@example2.dom<br />
|
|
||||||
DocumentRoot /www/example2<br />
|
|
||||||
</indent>
|
|
||||||
</VirtualHost>
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>Suppose that you've assigned 192.0.2.1 to
|
<p>Suppose that you've assigned 192.0.2.1 to
|
||||||
<code>www.example1.dom</code> and 192.0.2.2 to
|
<code>www.example1.dom</code> and 192.0.2.2 to
|
||||||
|
@ -446,14 +446,14 @@
|
|||||||
</module> and <module>mod_header</module> allows you to still accept
|
</module> and <module>mod_header</module> allows you to still accept
|
||||||
these headers:</p>
|
these headers:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
# <br />
|
#
|
||||||
# The following works around a client sending a broken Accept_Encoding<br />
|
# The following works around a client sending a broken Accept_Encoding
|
||||||
# header.<br />
|
# header.
|
||||||
#<br />
|
#
|
||||||
SetEnvIfNoCase ^Accept.Encoding$ ^(.*)$ fix_accept_encoding=$1<br />
|
SetEnvIfNoCase ^Accept.Encoding$ ^(.*)$ fix_accept_encoding=$1
|
||||||
RequestHeader set Accept-Encoding %{fix_accept_encoding}e env=fix_accept_encoding
|
RequestHeader set Accept-Encoding %{fix_accept_encoding}e env=fix_accept_encoding
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -464,27 +464,27 @@ RequestHeader set Accept-Encoding %{fix_accept_encoding}e env=fix_accept_encodin
|
|||||||
httpd.conf to deal with known client problems. Since the affected clients
|
httpd.conf to deal with known client problems. Since the affected clients
|
||||||
are no longer seen in the wild, this configuration is likely no-longer
|
are no longer seen in the wild, this configuration is likely no-longer
|
||||||
necessary.</p>
|
necessary.</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
#<br />
|
#
|
||||||
# The following directives modify normal HTTP response behavior.<br />
|
# The following directives modify normal HTTP response behavior.
|
||||||
# The first directive disables keepalive for Netscape 2.x and browsers that<br />
|
# The first directive disables keepalive for Netscape 2.x and browsers that
|
||||||
# spoof it. There are known problems with these browser implementations.<br />
|
# spoof it. There are known problems with these browser implementations.
|
||||||
# The second directive is for Microsoft Internet Explorer 4.0b2<br />
|
# The second directive is for Microsoft Internet Explorer 4.0b2
|
||||||
# which has a broken HTTP/1.1 implementation and does not properly<br />
|
# which has a broken HTTP/1.1 implementation and does not properly
|
||||||
# support keepalive when it is used on 301 or 302 (redirect) responses.<br />
|
# support keepalive when it is used on 301 or 302 (redirect) responses.
|
||||||
#<br />
|
#
|
||||||
BrowserMatch "Mozilla/2" nokeepalive<br />
|
BrowserMatch "Mozilla/2" nokeepalive
|
||||||
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0<br />
|
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
|
||||||
<br />
|
|
||||||
#<br />
|
#
|
||||||
# The following directive disables HTTP/1.1 responses to browsers which<br />
|
# The following directive disables HTTP/1.1 responses to browsers which
|
||||||
# are in violation of the HTTP/1.0 spec by not being able to understand a<br />
|
# are in violation of the HTTP/1.0 spec by not being able to understand a
|
||||||
# basic 1.1 response.<br />
|
# basic 1.1 response.
|
||||||
#<br />
|
#
|
||||||
BrowserMatch "RealPlayer 4\.0" force-response-1.0<br />
|
BrowserMatch "RealPlayer 4\.0" force-response-1.0
|
||||||
BrowserMatch "Java/1\.0" force-response-1.0<br />
|
BrowserMatch "Java/1\.0" force-response-1.0
|
||||||
BrowserMatch "JDK/1\.0" force-response-1.0
|
BrowserMatch "JDK/1\.0" force-response-1.0
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section id="no-img-log">
|
<section id="no-img-log">
|
||||||
@ -495,12 +495,12 @@ BrowserMatch "JDK/1\.0" force-response-1.0
|
|||||||
particular directories, or to prevent logging of requests
|
particular directories, or to prevent logging of requests
|
||||||
coming from particular hosts.</p>
|
coming from particular hosts.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
SetEnvIf Request_URI \.gif image-request<br />
|
SetEnvIf Request_URI \.gif image-request
|
||||||
SetEnvIf Request_URI \.jpg image-request<br />
|
SetEnvIf Request_URI \.jpg image-request
|
||||||
SetEnvIf Request_URI \.png image-request<br />
|
SetEnvIf Request_URI \.png image-request
|
||||||
CustomLog logs/access_log common env=!image-request
|
CustomLog logs/access_log common env=!image-request
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section id="image-theft">
|
<section id="image-theft">
|
||||||
@ -512,18 +512,16 @@ BrowserMatch "JDK/1\.0" force-response-1.0
|
|||||||
in limited circumstances. We assume that all your images are in
|
in limited circumstances. We assume that all your images are in
|
||||||
a directory called <code>/web/images</code>.</p>
|
a directory called <code>/web/images</code>.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
SetEnvIf Referer "^http://www\.example\.com/" local_referal<br />
|
SetEnvIf Referer "^http://www\.example\.com/" local_referal
|
||||||
# Allow browsers that do not send Referer info<br />
|
# Allow browsers that do not send Referer info
|
||||||
SetEnvIf Referer "^$" local_referal<br />
|
SetEnvIf Referer "^$" local_referal
|
||||||
<Directory /web/images><br />
|
<Directory /web/images>
|
||||||
<indent>
|
Order Deny,Allow
|
||||||
Order Deny,Allow<br />
|
Deny from all
|
||||||
Deny from all<br />
|
Allow from env=local_referal
|
||||||
Allow from env=local_referal
|
</Directory>
|
||||||
</indent>
|
</highlight>
|
||||||
</Directory>
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>For more information about this technique, see the
|
<p>For more information about this technique, see the
|
||||||
"<a href="http://www.serverwatch.com/tutorials/article.php/1132731"
|
"<a href="http://www.serverwatch.com/tutorials/article.php/1132731"
|
||||||
|
@ -52,8 +52,8 @@
|
|||||||
<seealso><module>mod_include</module></seealso>
|
<seealso><module>mod_include</module></seealso>
|
||||||
|
|
||||||
<section id="grammar">
|
<section id="grammar">
|
||||||
<title>Grammar in Backus–Naur Form notation</title>
|
<title>Grammar in Backus-Naur Form notation</title>
|
||||||
<p><a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form">Backus–Naur Form</a> (BNF) is a notation
|
<p><a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form">Backus-Naur Form</a> (BNF) is a notation
|
||||||
technique for context-free grammars, often used to describe the syntax of languages used in computing.
|
technique for context-free grammars, often used to describe the syntax of languages used in computing.
|
||||||
</p>
|
</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
@ -476,26 +476,22 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
|
|||||||
<title>Example expressions</title>
|
<title>Example expressions</title>
|
||||||
<p>The following examples show how expressions might be used to evaluate requests:</p>
|
<p>The following examples show how expressions might be used to evaluate requests:</p>
|
||||||
<!-- This section should probably be extended with more, useful examples -->
|
<!-- This section should probably be extended with more, useful examples -->
|
||||||
<example>
|
<highlight language="config">
|
||||||
# Compare the host name to example.com and redirect to www.example.com if it matches<br />
|
# Compare the host name to example.com and redirect to www.example.com if it matches
|
||||||
<If "%{HTTP_HOST} == 'example.com'"><br />
|
<If "%{HTTP_HOST} == 'example.com'">
|
||||||
<indent>
|
Redirect permanent / http://www.example.com
|
||||||
Redirect permanent / http://www.example.com<br />
|
</If>
|
||||||
</indent>
|
|
||||||
</If><br /><br />
|
# Force text/plain if requesting a file with the query string contains 'forcetext'
|
||||||
# Force text/plain if requesting a file with the query string contains 'forcetext'<br />
|
<If "%{QUERY_STRING} =~ /forcetext/">
|
||||||
<If "%{QUERY_STRING} =~ /forcetext/"><br />
|
ForceType text/plain
|
||||||
<indent>
|
</If>
|
||||||
ForceType text/plain<br />
|
|
||||||
</indent>
|
# Only allow access to this content during business hours
|
||||||
</If><br /><br />
|
<Directory "/foo/bar/business">
|
||||||
# Only allow access to this content during business hours<br />
|
Require expr %{TIME_HOUR} >= 9 && %{TIME_HOUR} <= 17
|
||||||
<Directory "/foo/bar/business"><br />
|
</Directory>
|
||||||
<indent>
|
</highlight>
|
||||||
Require expr %{TIME_HOUR} >= 9 && %{TIME_HOUR} <= 17 <br />
|
|
||||||
</indent>
|
|
||||||
</Directory>
|
|
||||||
</example>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="other">
|
<section id="other">
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
<module>mod_substitute</module>
|
<module>mod_substitute</module>
|
||||||
<module>mod_xml2enc</module>
|
<module>mod_xml2enc</module>
|
||||||
<module>mod_proxy_html</module>
|
<module>mod_proxy_html</module>
|
||||||
|
<module>mod_policy</module>
|
||||||
</modulelist>
|
</modulelist>
|
||||||
<directivelist>
|
<directivelist>
|
||||||
<directive module="mod_filter">FilterChain</directive>
|
<directive module="mod_filter">FilterChain</directive>
|
||||||
|
@ -382,7 +382,7 @@
|
|||||||
be written as "<code>/images/.*(jpg|gif)$</code>". In places where
|
be written as "<code>/images/.*(jpg|gif)$</code>". In places where
|
||||||
regular expressions are used to replace strings, the special variables
|
regular expressions are used to replace strings, the special variables
|
||||||
$1 ... $9 contain backreferences to the grouped parts (in parentheses) of
|
$1 ... $9 contain backreferences to the grouped parts (in parentheses) of
|
||||||
the matched expression. The special variable $0 contains a backerference
|
the matched expression. The special variable $0 contains a backreference
|
||||||
to the whole matched expression. To write a literal dollar sign in a
|
to the whole matched expression. To write a literal dollar sign in a
|
||||||
replacement string, it can be escaped with a backslash. Historically, the
|
replacement string, it can be escaped with a backslash. Historically, the
|
||||||
variable & could be used as alias for $0 in some places. This is no
|
variable & could be used as alias for $0 in some places. This is no
|
||||||
|
@ -105,10 +105,10 @@
|
|||||||
the <code>html</code> extension to trigger the launch of the
|
the <code>html</code> extension to trigger the launch of the
|
||||||
<code>footer.pl</code> CGI script.</p>
|
<code>footer.pl</code> CGI script.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Action add-footer /cgi-bin/footer.pl<br/>
|
Action add-footer /cgi-bin/footer.pl
|
||||||
AddHandler add-footer .html
|
AddHandler add-footer .html
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>Then the CGI script is responsible for sending the
|
<p>Then the CGI script is responsible for sending the
|
||||||
originally requested document (pointed to by the
|
originally requested document (pointed to by the
|
||||||
@ -126,11 +126,11 @@
|
|||||||
the <code>send-as-is</code> handler, regardless of their
|
the <code>send-as-is</code> handler, regardless of their
|
||||||
filename extensions.</p>
|
filename extensions.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Directory /web/htdocs/asis><br/>
|
<Directory /web/htdocs/asis>
|
||||||
SetHandler send-as-is<br/>
|
SetHandler send-as-is
|
||||||
</Directory>
|
</Directory>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
@ -142,9 +142,9 @@
|
|||||||
you may wish to make use of. Specifically, a new record has
|
you may wish to make use of. Specifically, a new record has
|
||||||
been added to the <code>request_rec</code> structure:</p>
|
been added to the <code>request_rec</code> structure:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="c">
|
||||||
char *handler
|
char *handler
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>If you wish to have your module engage a handler, you need
|
<p>If you wish to have your module engage a handler, you need
|
||||||
only to set <code>r->handler</code> to the name of the
|
only to set <code>r->handler</code> to the name of the
|
||||||
|
@ -138,7 +138,7 @@
|
|||||||
you may have to install the corresponding <code>-dev</code>
|
you may have to install the corresponding <code>-dev</code>
|
||||||
package to allow httpd to build against your installed copy
|
package to allow httpd to build against your installed copy
|
||||||
of PCRE.</dd>
|
of PCRE.</dd>
|
||||||
|
|
||||||
<dt>Disk Space</dt>
|
<dt>Disk Space</dt>
|
||||||
<dd>Make sure you have at least 50 MB of temporary free disk
|
<dd>Make sure you have at least 50 MB of temporary free disk
|
||||||
space available. After installation the server occupies
|
space available. After installation the server occupies
|
||||||
@ -364,7 +364,7 @@ $ tar xvf httpd-<em>NN</em>.tar
|
|||||||
major releases (for example, from 2.0 to 2.2 or from 2.2 to 2.3),
|
major releases (for example, from 2.0 to 2.2 or from 2.2 to 2.3),
|
||||||
there will likely be major differences in the compile-time and
|
there will likely be major differences in the compile-time and
|
||||||
run-time configuration that will require manual adjustments. All
|
run-time configuration that will require manual adjustments. All
|
||||||
modules will also need to be upgraded to accomodate changes in the
|
modules will also need to be upgraded to accommodate changes in the
|
||||||
module API.</p>
|
module API.</p>
|
||||||
|
|
||||||
<p>Upgrading from one minor version to the next (for example, from
|
<p>Upgrading from one minor version to the next (for example, from
|
||||||
|
@ -167,9 +167,9 @@
|
|||||||
<p>Do this by specifying the name of the module in your
|
<p>Do this by specifying the name of the module in your
|
||||||
<directive>LogLevel</directive> directive:</p>
|
<directive>LogLevel</directive> directive:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogLevel info rewrite:trace5
|
LogLevel info rewrite:trace5
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>This sets the main <directive>LogLevel</directive> to info, but
|
<p>This sets the main <directive>LogLevel</directive> to info, but
|
||||||
turns it up to <code>trace5</code> for
|
turns it up to <code>trace5</code> for
|
||||||
@ -235,10 +235,10 @@
|
|||||||
<p>A typical configuration for the access log might look as
|
<p>A typical configuration for the access log might look as
|
||||||
follows.</p>
|
follows.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
|
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||||
CustomLog logs/access_log common
|
CustomLog logs/access_log common
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>This defines the <em>nickname</em> <code>common</code> and
|
<p>This defines the <em>nickname</em> <code>common</code> and
|
||||||
associates it with a particular log format string. The format
|
associates it with a particular log format string. The format
|
||||||
@ -381,11 +381,10 @@
|
|||||||
<p>Another commonly used format string is called the Combined
|
<p>Another commonly used format string is called the Combined
|
||||||
Log Format. It can be used as follows.</p>
|
Log Format. It can be used as follows.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
|
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
|
||||||
\"%{User-agent}i\"" combined<br />
|
CustomLog log/access_log combined
|
||||||
CustomLog log/access_log combined
|
</highlight>
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>This format is exactly the same as the Common Log Format,
|
<p>This format is exactly the same as the Common Log Format,
|
||||||
with the addition of two more fields. Each of the additional
|
with the addition of two more fields. Each of the additional
|
||||||
@ -435,12 +434,12 @@
|
|||||||
to mimic the effects of the <code>ReferLog</code> and <code
|
to mimic the effects of the <code>ReferLog</code> and <code
|
||||||
>AgentLog</code> directives.</p>
|
>AgentLog</code> directives.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
|
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||||
CustomLog logs/access_log common<br />
|
CustomLog logs/access_log common
|
||||||
CustomLog logs/referer_log "%{Referer}i -> %U"<br />
|
CustomLog logs/referer_log "%{Referer}i -> %U"
|
||||||
CustomLog logs/agent_log "%{User-agent}i"
|
CustomLog logs/agent_log "%{User-agent}i"
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>This example also shows that it is not necessary to define a
|
<p>This example also shows that it is not necessary to define a
|
||||||
nickname with the <directive
|
nickname with the <directive
|
||||||
@ -464,34 +463,34 @@
|
|||||||
include or exclude requests where the environment variable is
|
include or exclude requests where the environment variable is
|
||||||
set. Some examples:</p>
|
set. Some examples:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
# Mark requests from the loop-back interface<br />
|
# Mark requests from the loop-back interface
|
||||||
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog<br />
|
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
|
||||||
# Mark requests for the robots.txt file<br />
|
# Mark requests for the robots.txt file
|
||||||
SetEnvIf Request_URI "^/robots\.txt$" dontlog<br />
|
SetEnvIf Request_URI "^/robots\.txt$" dontlog
|
||||||
# Log what remains<br />
|
# Log what remains
|
||||||
CustomLog logs/access_log common env=!dontlog
|
CustomLog logs/access_log common env=!dontlog
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>As another example, consider logging requests from
|
<p>As another example, consider logging requests from
|
||||||
english-speakers to one log file, and non-english speakers to a
|
english-speakers to one log file, and non-english speakers to a
|
||||||
different log file.</p>
|
different log file.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
SetEnvIf Accept-Language "en" english<br />
|
SetEnvIf Accept-Language "en" english<br />
|
||||||
CustomLog logs/english_log common env=english<br />
|
CustomLog logs/english_log common env=english<br />
|
||||||
CustomLog logs/non_english_log common env=!english
|
CustomLog logs/non_english_log common env=!english
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>In a caching scenario one would want to know about
|
<p>In a caching scenario one would want to know about
|
||||||
the efficiency of the cache. A very simple method to
|
the efficiency of the cache. A very simple method to
|
||||||
find this out would be:</p>
|
find this out would be:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
SetEnv CACHE_MISS 1<br />
|
SetEnv CACHE_MISS 1
|
||||||
LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache<br />
|
LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache
|
||||||
CustomLog logs/access_log common-cache
|
CustomLog logs/access_log common-cache
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p><module>mod_cache</module> will run before
|
<p><module>mod_cache</module> will run before
|
||||||
<module>mod_env</module> and when successfull will deliver the
|
<module>mod_env</module> and when successfull will deliver the
|
||||||
@ -502,10 +501,10 @@
|
|||||||
module="mod_log_config">LogFormat</directive> supports logging values
|
module="mod_log_config">LogFormat</directive> supports logging values
|
||||||
conditional upon the HTTP response code:</p>
|
conditional upon the HTTP response code:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogFormat "%400,501{User-agent}i" browserlog<br />
|
LogFormat "%400,501{User-agent}i" browserlog
|
||||||
LogFormat "%!200,304,302{Referer}i" refererlog
|
LogFormat "%!200,304,302{Referer}i" refererlog
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>In the first example, the <code>User-agent</code> will be
|
<p>In the first example, the <code>User-agent</code> will be
|
||||||
logged if the HTTP status code is 400 or 501. In other cases, a
|
logged if the HTTP status code is 400 or 501. In other cases, a
|
||||||
@ -586,10 +585,9 @@
|
|||||||
for this purpose. For example, to rotate the logs every 24 hours, you
|
for this purpose. For example, to rotate the logs every 24 hours, you
|
||||||
can use:</p>
|
can use:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
CustomLog "|/usr/local/apache/bin/rotatelogs
|
CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
|
||||||
/var/log/access_log 86400" common
|
</highlight>
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>Notice that quotes are used to enclose the entire command
|
<p>Notice that quotes are used to enclose the entire command
|
||||||
that will be called for the pipe. Although these examples are
|
that will be called for the pipe. Although these examples are
|
||||||
@ -608,11 +606,10 @@
|
|||||||
a shell. Use "<code>|$</code>" instead of "<code>|</code>"
|
a shell. Use "<code>|$</code>" instead of "<code>|</code>"
|
||||||
to spawn using a shell (usually with <code>/bin/sh -c</code>):</p>
|
to spawn using a shell (usually with <code>/bin/sh -c</code>):</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
# Invoke "rotatelogs" using a shell<br />
|
# Invoke "rotatelogs" using a shell
|
||||||
CustomLog "|$/usr/local/apache/bin/rotatelogs
|
CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
|
||||||
/var/log/access_log 86400" common
|
</highlight>
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>This was the default behaviour for Apache 2.2.
|
<p>This was the default behaviour for Apache 2.2.
|
||||||
Depending on the shell specifics this might lead to
|
Depending on the shell specifics this might lead to
|
||||||
@ -657,11 +654,10 @@
|
|||||||
later split the log into individual files. For example,
|
later split the log into individual files. For example,
|
||||||
consider the following directives.</p>
|
consider the following directives.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
LogFormat "%v %l %u %t \"%r\" %>s %b"
|
LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
|
||||||
comonvhost<br />
|
CustomLog logs/access_log comonvhost
|
||||||
CustomLog logs/access_log comonvhost
|
</highlight>
|
||||||
</example>
|
|
||||||
|
|
||||||
<p>The <code>%v</code> is used to log the name of the virtual
|
<p>The <code>%v</code> is used to log the name of the virtual
|
||||||
host that is serving the request. Then a program like <a
|
host that is serving the request. Then a program like <a
|
||||||
|
@ -75,11 +75,11 @@ with the following configuration, all requests will be redirected
|
|||||||
to another site only if the server is started using
|
to another site only if the server is started using
|
||||||
<code>httpd -DClosedForNow</code>:</p>
|
<code>httpd -DClosedForNow</code>:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<IfDefine ClosedForNow><br />
|
<IfDefine ClosedForNow>
|
||||||
Redirect / http://otherserver.example.com/<br />
|
Redirect / http://otherserver.example.com/
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>The <directive type="section" module="core">IfModule</directive>
|
<p>The <directive type="section" module="core">IfModule</directive>
|
||||||
directive is very similar, except it encloses directives that will
|
directive is very similar, except it encloses directives that will
|
||||||
@ -97,11 +97,11 @@ about missing modules.</p>
|
|||||||
module="mod_mime_magic">MimeMagicFile</directive> directive will be
|
module="mod_mime_magic">MimeMagicFile</directive> directive will be
|
||||||
applied only if <module>mod_mime_magic</module> is available.</p>
|
applied only if <module>mod_mime_magic</module> is available.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<IfModule mod_mime_magic.c><br />
|
<IfModule mod_mime_magic.c>
|
||||||
MimeMagicFile conf/magic<br />
|
MimeMagicFile conf/magic
|
||||||
</IfModule>
|
</IfModule>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>The <directive type="section" module="mod_version">IfVersion</directive>
|
<p>The <directive type="section" module="mod_version">IfVersion</directive>
|
||||||
directive is very similar to <directive type="section"
|
directive is very similar to <directive type="section"
|
||||||
@ -111,14 +111,12 @@ only be applied if a particular version of the server is executing. This
|
|||||||
module is designed for the use in test suites and large networks which have to
|
module is designed for the use in test suites and large networks which have to
|
||||||
deal with different httpd versions and different configurations.</p>
|
deal with different httpd versions and different configurations.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<IfVersion >= 2.1><br />
|
<IfVersion >= 2.1>
|
||||||
<indent>
|
# this happens only in versions greater or
|
||||||
# this happens only in versions greater or<br />
|
# equal 2.1.0.
|
||||||
# equal 2.1.0.<br />
|
|
||||||
</indent>
|
|
||||||
</IfVersion>
|
</IfVersion>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p><directive type="section" module="core">IfDefine</directive>,
|
<p><directive type="section" module="core">IfDefine</directive>,
|
||||||
<directive type="section" module="core">IfModule</directive>, and the
|
<directive type="section" module="core">IfModule</directive>, and the
|
||||||
@ -162,11 +160,11 @@ href="howto/htaccess.html">.htaccess files</a>. For example, in the
|
|||||||
following configuration, directory indexes will be enabled for the
|
following configuration, directory indexes will be enabled for the
|
||||||
<code>/var/web/dir1</code> directory and all subdirectories.</p>
|
<code>/var/web/dir1</code> directory and all subdirectories.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Directory /var/web/dir1><br />
|
<Directory /var/web/dir1>
|
||||||
Options +Indexes<br />
|
Options +Indexes
|
||||||
</Directory>
|
</Directory>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>Directives enclosed in a <directive type="section"
|
<p>Directives enclosed in a <directive type="section"
|
||||||
module="core">Files</directive> section apply to any file with
|
module="core">Files</directive> section apply to any file with
|
||||||
@ -176,12 +174,12 @@ when placed in the main section of the configuration file,
|
|||||||
deny access to any file named <code>private.html</code> regardless
|
deny access to any file named <code>private.html</code> regardless
|
||||||
of where it is found.</p>
|
of where it is found.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Files private.html><br />
|
<Files private.html>
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</Files>
|
</Files>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>To address files found in a particular part of the filesystem, the
|
<p>To address files found in a particular part of the filesystem, the
|
||||||
<directive type="section" module="core">Files</directive> and
|
<directive type="section" module="core">Files</directive> and
|
||||||
@ -193,14 +191,14 @@ access to <code>/var/web/dir1/private.html</code>,
|
|||||||
of <code>private.html</code> found under the <code>/var/web/dir1/</code>
|
of <code>private.html</code> found under the <code>/var/web/dir1/</code>
|
||||||
directory.</p>
|
directory.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Directory /var/web/dir1><br />
|
<Directory /var/web/dir1>
|
||||||
<Files private.html><br />
|
<Files private.html>
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</Files><br />
|
</Files>
|
||||||
</Directory>
|
</Directory>
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="webspace"><title>Webspace Containers</title>
|
<section id="webspace"><title>Webspace Containers</title>
|
||||||
@ -216,12 +214,12 @@ In particular, it will apply to requests for
|
|||||||
<code>http://yoursite.example.com/private/dir/file.html</code> as well
|
<code>http://yoursite.example.com/private/dir/file.html</code> as well
|
||||||
as any other requests starting with the <code>/private</code> string.</p>
|
as any other requests starting with the <code>/private</code> string.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<LocationMatch ^/private><br />
|
<LocationMatch ^/private>
|
||||||
Order Allow,Deny<br />
|
Order Allow,Deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</Location>
|
</Location>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>The <directive type="section" module="core">Location</directive>
|
<p>The <directive type="section" module="core">Location</directive>
|
||||||
directive need not have anything to do with the filesystem.
|
directive need not have anything to do with the filesystem.
|
||||||
@ -230,35 +228,35 @@ URL to an internal Apache HTTP Server handler provided by <module>mod_status</mo
|
|||||||
No file called <code>server-status</code> needs to exist in the
|
No file called <code>server-status</code> needs to exist in the
|
||||||
filesystem.</p>
|
filesystem.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Location /server-status><br />
|
<Location /server-status>
|
||||||
SetHandler server-status<br />
|
SetHandler server-status
|
||||||
</Location>
|
</Location>
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="overlapping-webspace"><title>Overlapping Webspace</title>
|
<section id="overlapping-webspace"><title>Overlapping Webspace</title>
|
||||||
<p>In order to have two overlapping URLs one has to consider the order in which
|
<p>In order to have two overlapping URLs one has to consider the order in which
|
||||||
certain sections or directives are evaluated. For
|
certain sections or directives are evaluated. For
|
||||||
<directive type="section" module="core">Location</directive> this would be:</p>
|
<directive type="section" module="core">Location</directive> this would be:</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Location /foo><br />
|
<Location /foo>
|
||||||
</Location><br />
|
</Location>
|
||||||
<Location /foo/bar><br />
|
<Location /foo/bar>
|
||||||
</Location>
|
</Location>
|
||||||
</example>
|
</highlight>
|
||||||
<p><directive type="section" module="mod_alias">Alias</directive>es on the other hand,
|
<p><directive type="section" module="mod_alias">Alias</directive>es on the other hand,
|
||||||
are mapped vice-versa:</p>
|
are mapped vice-versa:</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
Alias /foo/bar /srv/www/uncommon/bar<br />
|
Alias /foo/bar /srv/www/uncommon/bar
|
||||||
Alias /foo /srv/www/common/foo<br />
|
Alias /foo /srv/www/common/foo
|
||||||
</example>
|
</highlight>
|
||||||
<p>The same is true for the <directive module="mod_proxy">ProxyPass</directive>
|
<p>The same is true for the <directive module="mod_proxy">ProxyPass</directive>
|
||||||
directives:</p>
|
directives:</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
ProxyPass /special-area http://special.example.com smax=5 max=10<br />
|
ProxyPass /special-area http://special.example.com smax=5 max=10
|
||||||
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On
|
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="wildcards"><title>Wildcards and Regular Expressions</title>
|
<section id="wildcards"><title>Wildcards and Regular Expressions</title>
|
||||||
@ -287,20 +285,20 @@ how directives are applied.</p>
|
|||||||
<p>A non-regex wildcard section that changes the configuration of
|
<p>A non-regex wildcard section that changes the configuration of
|
||||||
all user directories could look as follows:</p>
|
all user directories could look as follows:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Directory /home/*/public_html><br />
|
<Directory /home/*/public_html>
|
||||||
Options Indexes<br />
|
Options Indexes
|
||||||
</Directory>
|
</Directory>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>Using regex sections, we can deny access to many types of image files
|
<p>Using regex sections, we can deny access to many types of image files
|
||||||
at once:</p>
|
at once:</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
<FilesMatch \.(?i:gif|jpe?g|png)$><br />
|
<FilesMatch \.(?i:gif|jpe?g|png)$>
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -310,11 +308,11 @@ directive change the configuration depending on a condition which can be
|
|||||||
expressed by a boolean expression. For example, the following configuration
|
expressed by a boolean expression. For example, the following configuration
|
||||||
denies access if the HTTP Referer header does not start with
|
denies access if the HTTP Referer header does not start with
|
||||||
"http://www.example.com/".</p>
|
"http://www.example.com/".</p>
|
||||||
<example>
|
<highlight language="config">
|
||||||
<If "!(%{HTTP_REFERER} -strmatch 'http://www.example.com/*')"><br />
|
<If "!(%{HTTP_REFERER} -strmatch 'http://www.example.com/*')">
|
||||||
Require all denied<br />
|
Require all denied
|
||||||
</If>
|
</If>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -336,12 +334,12 @@ different webspace locations (URLs) could map to the same filesystem
|
|||||||
location, allowing your restrictions to be circumvented.
|
location, allowing your restrictions to be circumvented.
|
||||||
For example, consider the following configuration:</p>
|
For example, consider the following configuration:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Location /dir/><br />
|
<Location /dir/>
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</Location>
|
</Location>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>This works fine if the request is for
|
<p>This works fine if the request is for
|
||||||
<code>http://yoursite.example.com/dir/</code>. But what if you are on
|
<code>http://yoursite.example.com/dir/</code>. But what if you are on
|
||||||
@ -404,12 +402,12 @@ that match the specified URL. For example, the following configuration
|
|||||||
will prevent the proxy server from being used to access the
|
will prevent the proxy server from being used to access the
|
||||||
<code>www.example.com</code> website.</p>
|
<code>www.example.com</code> website.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Proxy http://www.example.com/*><br />
|
<Proxy http://www.example.com/*>
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Deny from all<br />
|
Deny from all
|
||||||
</Proxy>
|
</Proxy>
|
||||||
</example>
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="whatwhere"><title>What Directives are Allowed?</title>
|
<section id="whatwhere"><title>What Directives are Allowed?</title>
|
||||||
@ -530,30 +528,30 @@ merging. Assuming they all apply to the request, the directives in
|
|||||||
this example will be applied in the order A > B > C > D >
|
this example will be applied in the order A > B > C > D >
|
||||||
E.</p>
|
E.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Location /><br />
|
<Location />
|
||||||
E<br />
|
E
|
||||||
</Location><br />
|
</Location>
|
||||||
<br />
|
|
||||||
<Files f.html><br />
|
<Files f.html>
|
||||||
D<br />
|
D
|
||||||
</Files><br />
|
</Files>
|
||||||
<br />
|
|
||||||
<VirtualHost *><br />
|
<VirtualHost *>
|
||||||
<Directory /a/b><br />
|
<Directory /a/b>
|
||||||
B<br />
|
B
|
||||||
</Directory><br />
|
</Directory>
|
||||||
</VirtualHost><br />
|
</VirtualHost>
|
||||||
<br />
|
|
||||||
<DirectoryMatch "^.*b$"><br />
|
<DirectoryMatch "^.*b$">
|
||||||
C<br />
|
C
|
||||||
</DirectoryMatch><br />
|
</DirectoryMatch>
|
||||||
<br />
|
|
||||||
<Directory /a/b><br />
|
<Directory /a/b>
|
||||||
A<br />
|
A
|
||||||
</Directory><br />
|
</Directory>
|
||||||
<br />
|
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>For a more concrete example, consider the following. Regardless of
|
<p>For a more concrete example, consider the following. Regardless of
|
||||||
any access restrictions placed in <directive module="core"
|
any access restrictions placed in <directive module="core"
|
||||||
@ -562,19 +560,19 @@ module="core" type="section">Location</directive> section will be
|
|||||||
evaluated last and will allow unrestricted access to the server. In
|
evaluated last and will allow unrestricted access to the server. In
|
||||||
other words, order of merging is important, so be careful!</p>
|
other words, order of merging is important, so be careful!</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
<Location /><br />
|
<Location />
|
||||||
Order deny,allow<br />
|
Order deny,allow
|
||||||
Allow from all<br />
|
Allow from all
|
||||||
</Location><br />
|
</Location>
|
||||||
<br />
|
|
||||||
# Woops! This <Directory> section will have no effect<br />
|
# Woops! This <Directory> section will have no effect
|
||||||
<Directory /><br />
|
<Directory />
|
||||||
Order allow,deny<br />
|
Order allow,deny
|
||||||
Allow from all<br />
|
Allow from all
|
||||||
Deny from badguy.example.com<br />
|
Deny from badguy.example.com
|
||||||
</Directory>
|
</Directory>
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<p>The only configuration required is to select which cache provider
|
<p>The only configuration required is to select which cache provider
|
||||||
to use. This is the responsibility of modules using the cache, and
|
to use. This is the responsibility of modules using the cache, and
|
||||||
they enable selection using directives such as
|
they enable selection using directives such as
|
||||||
|
<directive module="mod_cache_socache">CacheSocache</directive>,
|
||||||
<directive module="mod_authn_socache">AuthnCacheSOCache</directive>,
|
<directive module="mod_authn_socache">AuthnCacheSOCache</directive>,
|
||||||
<directive module="mod_ssl">SSLSessionCache</directive>, and
|
<directive module="mod_ssl">SSLSessionCache</directive>, and
|
||||||
<directive module="mod_ssl">SSLStaplingCache</directive>.</p>
|
<directive module="mod_ssl">SSLStaplingCache</directive>.</p>
|
||||||
|
@ -239,7 +239,7 @@
|
|||||||
|
|
||||||
<p class="indent">
|
<p class="indent">
|
||||||
If it doesn't exist, it can't very well contain files. If we
|
If it doesn't exist, it can't very well contain files. If we
|
||||||
can't change directory to it, it might aswell not exist.
|
can't change directory to it, it might as well not exist.
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -466,10 +466,10 @@
|
|||||||
|
|
||||||
<p>If for example, your web server is configured to run as:</p>
|
<p>If for example, your web server is configured to run as:</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
User www<br />
|
User www
|
||||||
Group webgroup<br />
|
Group webgroup
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>and <program>suexec</program> is installed at
|
<p>and <program>suexec</program> is installed at
|
||||||
"/usr/local/apache2/bin/suexec", you should run:</p>
|
"/usr/local/apache2/bin/suexec", you should run:</p>
|
||||||
|
@ -84,12 +84,6 @@
|
|||||||
|
|
||||||
<li>configure: the "reallyall" module set adds developer modules
|
<li>configure: the "reallyall" module set adds developer modules
|
||||||
to the "all" set</li>
|
to the "all" set</li>
|
||||||
|
|
||||||
<li>apr and apr-util: APR and APR-Util are no longer bundled with
|
|
||||||
Apache httpd 2.4. You can either use already installed versions or
|
|
||||||
continue to use <code>--with-included-apr</code> after downloading
|
|
||||||
(from <a href="http://apr.apache.org/">Apache APR</a>) and unpacking
|
|
||||||
apr/apr-util into <code>./srclib/</code></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
@ -136,23 +130,31 @@
|
|||||||
<p>In this example, all requests are denied.</p>
|
<p>In this example, all requests are denied.</p>
|
||||||
<example>
|
<example>
|
||||||
<title>2.2 configuration:</title>
|
<title>2.2 configuration:</title>
|
||||||
Order deny,allow<br />
|
<highlight language="config">
|
||||||
Deny from all
|
Order deny,allow
|
||||||
|
Deny from all
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
<example>
|
<example>
|
||||||
<title>2.4 configuration:</title>
|
<title>2.4 configuration:</title>
|
||||||
|
<highlight language="config">
|
||||||
Require all denied
|
Require all denied
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<p>In this example, all requests are allowed.</p>
|
<p>In this example, all requests are allowed.</p>
|
||||||
<example>
|
<example>
|
||||||
<title>2.2 configuration:</title>
|
<title>2.2 configuration:</title>
|
||||||
Order allow,deny<br />
|
<highlight language="config">
|
||||||
Allow from all
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
<example>
|
<example>
|
||||||
<title>2.4 configuration:</title>
|
<title>2.4 configuration:</title>
|
||||||
|
<highlight language="config">
|
||||||
Require all granted
|
Require all granted
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<p>In the following example, all hosts in the example.org domain
|
<p>In the following example, all hosts in the example.org domain
|
||||||
@ -160,13 +162,17 @@
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>2.2 configuration:</title>
|
<title>2.2 configuration:</title>
|
||||||
Order Deny,Allow<br />
|
<highlight language="config">
|
||||||
Deny from all<br />
|
Order Deny,Allow
|
||||||
Allow from example.org
|
Deny from all
|
||||||
|
Allow from example.org
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
<example>
|
<example>
|
||||||
<title>2.4 configuration:</title>
|
<title>2.4 configuration:</title>
|
||||||
|
<highlight language="config">
|
||||||
Require host example.org
|
Require host example.org
|
||||||
|
</highlight>
|
||||||
</example>
|
</example>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
module="mod_alias">Alias</directive> directive will map any part
|
module="mod_alias">Alias</directive> directive will map any part
|
||||||
of the filesystem into the web space. For example, with</p>
|
of the filesystem into the web space. For example, with</p>
|
||||||
|
|
||||||
<example>Alias /docs /var/web</example>
|
<highlight language="config">Alias /docs /var/web</highlight>
|
||||||
|
|
||||||
<p>the URL <code>http://www.example.com/docs/dir/file.html</code>
|
<p>the URL <code>http://www.example.com/docs/dir/file.html</code>
|
||||||
will be served from <code>/var/web/dir/file.html</code>. The
|
will be served from <code>/var/web/dir/file.html</code>. The
|
||||||
@ -134,8 +134,9 @@
|
|||||||
expression</glossary> based matching and substitution. For
|
expression</glossary> based matching and substitution. For
|
||||||
example,</p>
|
example,</p>
|
||||||
|
|
||||||
<example>ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+)
|
<highlight language="config">
|
||||||
/home/$1/cgi-bin/$2</example>
|
ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+) /home/$1/cgi-bin/$2
|
||||||
|
</highlight>
|
||||||
|
|
||||||
<p>will map a request to
|
<p>will map a request to
|
||||||
<code>http://example.com/~user/cgi-bin/script.cgi</code> to the
|
<code>http://example.com/~user/cgi-bin/script.cgi</code> to the
|
||||||
@ -181,8 +182,9 @@
|
|||||||
<code>/home/user/public_html/file.html</code>, use the following
|
<code>/home/user/public_html/file.html</code>, use the following
|
||||||
<code>AliasMatch</code> directive:</p>
|
<code>AliasMatch</code> directive:</p>
|
||||||
|
|
||||||
<example>AliasMatch ^/upages/([a-zA-Z0-9]+)(/(.*))?$
|
<highlight language="config">
|
||||||
/home/$1/public_html/$3</example>
|
AliasMatch ^/upages/([a-zA-Z0-9]+)(/(.*))?$ /home/$1/public_html/$3
|
||||||
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="redirect"><title>URL Redirection</title>
|
<section id="redirect"><title>URL Redirection</title>
|
||||||
@ -200,8 +202,9 @@
|
|||||||
to the new directory <code>/bar/</code>, you can instruct clients
|
to the new directory <code>/bar/</code>, you can instruct clients
|
||||||
to request the content at the new location as follows:</p>
|
to request the content at the new location as follows:</p>
|
||||||
|
|
||||||
<example>Redirect permanent /foo/
|
<highlight language="config">
|
||||||
http://www.example.com/bar/</example>
|
Redirect permanent /foo/ http://www.example.com/bar/
|
||||||
|
</highlight>
|
||||||
|
|
||||||
<p>This will redirect any URL-Path starting in
|
<p>This will redirect any URL-Path starting in
|
||||||
<code>/foo/</code> to the same URL path on the
|
<code>/foo/</code> to the same URL path on the
|
||||||
@ -215,14 +218,16 @@
|
|||||||
for the site home page to a different site, but leave all other
|
for the site home page to a different site, but leave all other
|
||||||
requests alone, use the following configuration:</p>
|
requests alone, use the following configuration:</p>
|
||||||
|
|
||||||
<example>RedirectMatch permanent ^/$
|
<highlight language="config">
|
||||||
http://www.example.com/startpage.html</example>
|
RedirectMatch permanent ^/$ http://www.example.com/startpage.html
|
||||||
|
</highlight>
|
||||||
|
|
||||||
<p>Alternatively, to temporarily redirect all pages on one site
|
<p>Alternatively, to temporarily redirect all pages on one site
|
||||||
to a particular page on another site, use the following:</p>
|
to a particular page on another site, use the following:</p>
|
||||||
|
|
||||||
<example>RedirectMatch temp .*
|
<highlight language="config">
|
||||||
http://othersite.example.com/startpage.html</example>
|
RedirectMatch temp .* http://othersite.example.com/startpage.html
|
||||||
|
</highlight>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="proxy"><title>Reverse Proxy</title>
|
<section id="proxy"><title>Reverse Proxy</title>
|
||||||
@ -240,12 +245,12 @@ the <code>/bar/</code> directory on <code>internal.example.com</code>
|
|||||||
and returns them to the client as if they were from the local
|
and returns them to the client as if they were from the local
|
||||||
server.</p>
|
server.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
ProxyPass /foo/ http://internal.example.com/bar/<br />
|
ProxyPass /foo/ http://internal.example.com/bar/<br />
|
||||||
ProxyPassReverse /foo/ http://internal.example.com/bar/<br />
|
ProxyPassReverse /foo/ http://internal.example.com/bar/<br />
|
||||||
ProxyPassReverseCookieDomain internal.example.com public.example.com<br />
|
ProxyPassReverseCookieDomain internal.example.com public.example.com<br />
|
||||||
ProxyPassReverseCookiePath /foo/ /bar/
|
ProxyPassReverseCookiePath /foo/ /bar/
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>The <directive module="mod_proxy">ProxyPass</directive> configures
|
<p>The <directive module="mod_proxy">ProxyPass</directive> configures
|
||||||
the server to fetch the appropriate documents, while the
|
the server to fetch the appropriate documents, while the
|
||||||
@ -264,11 +269,11 @@ breaking out of the proxy server and requesting directly from
|
|||||||
content) in a page as it is being served to the client using
|
content) in a page as it is being served to the client using
|
||||||
<module>mod_substitute</module>.</p>
|
<module>mod_substitute</module>.</p>
|
||||||
|
|
||||||
<example>
|
<highlight language="config">
|
||||||
Substitute s/internal\.example\.com/www.example.com/i
|
Substitute s/internal\.example\.com/www.example.com/i
|
||||||
</example>
|
</highlight>
|
||||||
|
|
||||||
<p>For more sophisticated rewriting of links in HTML and XHTML, the
|
<p>For more sophisticated rewriting of links in HTML and XHTML, the
|
||||||
<module>mod_proxy_html</module> module is also available. It allows you
|
<module>mod_proxy_html</module> module is also available. It allows you
|
||||||
to create maps of URLs that need to be rewritten, so that complex
|
to create maps of URLs that need to be rewritten, so that complex
|
||||||
proxying scenarios can be handled.</p>
|
proxying scenarios can be handled.</p>
|
||||||
|
Reference in New Issue
Block a user