<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1238738:1331035 (outdated) -->
+<!-- English Revision: 1238738:1331240 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
enable <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="../mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a></code>.</p>
<div class="example"><h3>Single application instance</h3><p><code>
+ <pre class="prettyprint lang-config">
ProxyPass /myapp/ fcgi://localhost:4000/
+ </pre>
+
</code></p></div>
<p>This application should be able to handle multiple concurrent
the following example:</p>
<div class="example"><h3>Single application instance, no connection reuse</h3><p><code>
+ <pre class="prettyprint lang-config">
ProxyPass /myapp/ fcgi://localhost:4000/ disablereuse=on
+ </pre>
+
</code></p></div>
<p>The balanced gateway needs <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> and
default, and will be used for this example configuration.</p>
<div class="example"><h3>Balanced gateway to multiple application instances</h3><p><code>
- ProxyPass /myapp/ balancer://myappcluster/<br />
- <Proxy balancer://myappcluster/><br />
- <span class="indent">
- BalancerMember fcgi://localhost:4000/<br />
- BalancerMember fcgi://localhost:4001/<br />
- </span>
- </Proxy>
+ <pre class="prettyprint lang-config">
+ProxyPass /myapp/ balancer://myappcluster/
+<Proxy balancer://myappcluster/>
+ BalancerMember fcgi://localhost:4000/
+ BalancerMember fcgi://localhost:4001/
+</Proxy>
+ </pre>
+
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
enable <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="../mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code>.</p>
<div class="example"><h3>Simple gateway</h3><p><code>
+ <pre class="prettyprint lang-config">
ProxyPass /scgi-bin/ scgi://localhost:4000/
+ </pre>
+
</code></p></div>
<p>The balanced gateway needs <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> and
default, and will be used for this example configuration.</p>
<div class="example"><h3>Balanced gateway</h3><p><code>
- ProxyPass /scgi-bin/ balancer://somecluster/<br />
- <Proxy balancer://somecluster/><br />
- <span class="indent">
- BalancerMember scgi://localhost:4000/<br />
- BalancerMember scgi://localhost:4001/<br />
- </span>
- </Proxy>
+ <pre class="prettyprint lang-config">
+ProxyPass /scgi-bin/ balancer://somecluster/
+<Proxy balancer://somecluster/>
+ BalancerMember scgi://localhost:4000/
+ BalancerMember scgi://localhost:4001/
+</Proxy>
+ </pre>
+
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
feature.</p>
<div class="example"><h3>Example</h3><p><code>
+ <pre class="prettyprint lang-config">
ProxySCGIInternalRedirect Off
+ </pre>
+
</code></p></div>
</div>
</dl>
<div class="example"><h3>Example</h3><p><code>
- # Use the default header (X-Sendfile)<br />
- ProxySCGISendfile On<br />
- <br />
- # Use a different header<br />
+ <pre class="prettyprint lang-config">
+ # Use the default header (X-Sendfile)
+ ProxySCGISendfile On
+
+ # Use a different header
ProxySCGISendfile X-Send-Static
+ </pre>
+
</code></p></div>
</div>
variable <code>rate-limit</code>.</p>
<div class="example"><h3>Example Configuration</h3><p><code>
-<Location /downloads><br />
-<span class="indent">
-SetOutputFilter RATE_LIMIT<br />
-SetEnv rate-limit 400 <br />
-</span>
+<pre class="prettyprint lang-config">
+<Location /downloads>
+ SetOutputFilter RATE_LIMIT
+ SetEnv rate-limit 400
</Location>
+</pre>
+
</code></p></div>
</div>
<dd>Pass the request body through the DEFLATE filter to compress the
body. This request requires a Content-Encoding request header containing
"gzip" for the filter to return compressed data.
- <div class="example"><p><code>
- <Location /compress><br />
- SetHandler reflector<br />
- SetOutputFilter DEFLATE<br />
- </Location>
- </code></p></div>
+ <pre class="prettyprint lang-config">
+<Location /compress>
+ SetHandler reflector
+ SetOutputFilter DEFLATE
+</Location>
+ </pre>
+
</dd>
<dt>Image downsampling service</dt>
<dd>Pass the request body through an image downsampling filter, and reflect
the results to the caller.
- <div class="example"><p><code>
- <Location /downsample><br />
- SetHandler reflector<br />
- SetOutputFilter DOWNSAMPLE<br />
- </Location>
- </code></p></div>
+ <pre class="prettyprint lang-config">
+<Location /downsample>
+ SetHandler reflector
+ SetOutputFilter DOWNSAMPLE
+</Location>
+ </pre>
+
</dd>
</dl>
</div>
Allow 10 seconds to receive the request including the headers and
30 seconds for receiving the request body:
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
RequestReadTimeout header=10 body=30
- </code></p></div>
+ </pre>
+
</li>
<li>
the limit given indirectly by
<code class="directive"><a href="../mod/core.html#limitrequestbody">LimitRequestBody</a></code>):
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
RequestReadTimeout body=10,MinRate=1000
- </code></p></div>
+ </pre>
+
</li>
<li>
500 bytes received. But do not allow more than 30 seconds for the
request including the headers:
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
RequestReadTimeout header=10-30,MinRate=500
- </code></p></div>
+ </pre>
+
</li>
<li>
If a common configuration is used for http and https virtual hosts, the
timeouts should not be set too low:
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
- </code></p></div>
+ </pre>
+
</li>
</ol>
stored on the browser, in a cookie called <code>session</code>.</p>
<div class="example"><h3>Browser based session</h3><p><code>
- Session On<br />
- SessionCookieName session path=/<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionCookieName session path=/
+ </pre>
+
</code></p></div>
<p>The session is not useful unless it can be written to or read from. The
<code>X-Replace-Session</code>.</p>
<div class="example"><h3>Writing to a session</h3><p><code>
- Session On<br />
- SessionCookieName session path=/<br />
- SessionHeader X-Replace-Session<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionCookieName session path=/
+SessionHeader X-Replace-Session
+ </pre>
+
</code></p></div>
<p>The header should contain name value pairs expressed in the same format
empty string has the effect of removing that key from the session.</p>
<div class="example"><h3>CGI to write to a session</h3><p><code>
- #!/bin/bash<br />
- echo "Content-Type: text/plain"<br />
- echo "X-Replace-Session: key1=foo&key2=&key3=bar"<br />
- echo<br />
- env<br />
+ <pre class="prettyprint lang-sh">
+#!/bin/bash
+echo "Content-Type: text/plain"
+echo "X-Replace-Session: key1=foo&key2=&key3=bar"
+echo
+env
+ </pre>
+
</code></p></div>
<p>If configured, the session can be read back from the HTTP_SESSION
<code class="directive"><a href="#sessionenv">SessionEnv</a></code> directive.</p>
<div class="example"><h3>Read from a session</h3><p><code>
- Session On<br />
- SessionEnv On<br />
- SessionCookieName session path=/<br />
- SessionHeader X-Replace-Session<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionEnv On
+SessionCookieName session path=/
+SessionHeader X-Replace-Session
+ </pre>
+
</code></p></div>
<p>Once read, the CGI variable <code>HTTP_SESSION</code> should contain
module.</p>
<div class="example"><h3>Browser based encrypted session</h3><p><code>
- Session On<br />
- SessionCryptoPassphrase secret<br />
- SessionCookieName session path=/<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionCryptoPassphrase secret
+SessionCookieName session path=/
+ </pre>
+
</code></p></div>
<p>The session will be automatically decrypted on load, and encrypted on
as in the example below.</p>
<div class="example"><h3>Setting cookie parameters</h3><p><code>
- Session On<br />
- SessionCryptoPassphrase secret<br />
- SessionCookieName session path=/private;domain=example.com;httponly;secure;<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionCryptoPassphrase secret
+SessionCookieName session path=/private;domain=example.com;httponly;secure;
+ </pre>
+
</code></p></div>
<p>In cases where the Apache server forms the frontend for backend origin servers,
the session.</p>
<div class="example"><h3>Form based authentication</h3><p><code>
- Session On<br />
- SessionCryptoPassphrase secret<br />
- SessionCookieName session path=/<br />
- AuthFormProvider file<br />
- AuthUserFile conf/passwd<br />
- AuthType form<br />
- AuthName realm<br />
- ...<br />
+ <pre class="prettyprint lang-config">
+Session On
+SessionCryptoPassphrase secret
+SessionCookieName session path=/
+AuthFormProvider file
+AuthUserFile conf/passwd
+AuthType form
+AuthName realm
+#...
+ </pre>
+
</code></p></div>
<p>See the <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> module for documentation and complete
``<code>%{</code><em>name</em><code>}c</code>'' cryptography format function
provided. Information about this function is provided in the <a href="../ssl/ssl_compat.html">Compatibility</a> chapter.</p>
<div class="example"><h3>Example</h3><p><code>
-<pre class="prettyprint lang-config">
+<pre class="prettyprint lang-config">
CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</pre>
</dl>
<div class="example"><h3>Example</h3><p><code>
- <Location />
- <span class="indent">
- AddOutputFilterByType SUBSTITUTE text/html<br />
- Substitute s/foo/bar/ni<br />
- </span>
- </Location>
+ <pre class="prettyprint lang-config">
+<Location />
+ AddOutputFilterByType SUBSTITUTE text/html
+ Substitute s/foo/bar/ni
+</Location>
+ </pre>
+
</code></p></div>
<p>If either the pattern or the substitution contain a slash
character then an alternative delimiter should be used:</p>
<div class="example"><h3>Example of using an alternate delimiter</h3><p><code>
- <Location />
- <span class="indent">
- AddOutputFilterByType SUBSTITUTE text/html<br />
- Substitute "s|<BR */?>|<br />|i"
- </span>
- </Location>
+ <pre class="prettyprint lang-config">
+<Location />
+ AddOutputFilterByType SUBSTITUTE text/html
+ Substitute "s|<BR */?>|<br />|i"
+</Location>
+ </pre>
+
</code></p></div>
<p>Backreferences can be used in the comparison and in the substitution,
when regular expressions are used, as illustrated in the following example: </p>
<div class="example"><h3>Example of using backreferences and captures</h3><p><code>
- <Location />
- <span class="indent">
- AddOutputFilterByType SUBSTITUTE text/html<br />
- # "foo=k,bar=k" -> "foo/bar=k" <br />
- Substitute "s|foo=(\w+),bar=\1|foo/bar=$1"
- </span>
- </Location>
+ <pre class="prettyprint lang-config">
+<Location />
+ AddOutputFilterByType SUBSTITUTE text/html
+ # "foo=k,bar=k" -> "foo/bar=k"
+ Substitute "s|foo=(\w+),bar=\1|foo/bar=$1"
+</Location>
+ </pre>
+
</code></p></div>
<p>A common use scenario for <code>mod_substitute</code> is the
those URLs into something that will work from the front end:</p>
<div class="example"><h3>Rewriting URLs embedded in proxied content</h3><p><code>
- ProxyPass /blog/ http://internal.blog.example.com<br />
- ProxyPassReverse /blog/ http://internal.blog.example.com/<br />
- <br />
- Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i"
+ <pre class="prettyprint lang-config">
+ProxyPass /blog/ http://internal.blog.example.com
+ProxyPassReverse /blog/ http://internal.blog.example.com/
+
+Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i"
+ </pre>
+
</code></p></div>
<p><code class="directive"><a href="../mod/mod_proxy.html#proxypassreverse">ProxyPassReverse</a></code>
<p><code class="module"><a href="../mod/mod_usertrack.html">mod_usertrack</a></code> sets a cookie which can be logged
via <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code> configurable logging formats:</p>
- <div class="example"><p><code>
- LogFormat "%{Apache}n %r %t" usertrack<br />
- CustomLog logs/clickstream.log usertrack
- </code></p></div>
+ <pre class="prettyprint lang-config">
+LogFormat "%{Apache}n %r %t" usertrack
+CustomLog logs/clickstream.log usertrack
+ </pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
level domain (for example <code>.example.co.uk</code>).
</div>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
CookieDomain .example.com
- </code></p></div>
+ </pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<p>If this directive is not used, cookies last only for the
current browser session.</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
CookieExpires "3 weeks"
- </code></p></div>
+ </pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
unpredictable if you use a name containing unusual characters.
Valid characters include A-Z, a-z, 0-9, "_", and "-".</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
CookieName clicktrack
- </code></p></div>
+ </pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
three of these formats, with <code>Cookie2</code> being the
preferred format.</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
CookieStyle Cookie2
- </code></p></div>
+ </pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<code class="module"><a href="../mod/mod_usertrack.html">mod_usertrack</a></code> will <strong>not</strong>
activate cookies. </p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
CookieTracking on
- </code></p></div>
+ </pre>
+
</div>
/cgi-bin/script.pl</code> to <code>
/usr/local/apache2/cgi-bin/script.pl</code> in all cases:</p>
- <div class="example"><p><code>
- ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/<br />
- VirtualScriptAlias /never/found/%0/cgi-bin/
- </code></p></div>
+ <pre class="prettyprint lang-config">
+ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/
+VirtualScriptAlias /never/found/%0/cgi-bin/
+ </pre>
+
</div>
</div>
<div id="quickview"><h3 class="directives">Directives</h3>
<p>For simple name-based virtual hosts you might use the
following directives in your server configuration file:</p>
- <div class="example"><p><code>
- UseCanonicalName Off<br />
- VirtualDocumentRoot /usr/local/apache/vhosts/%0
- </code></p></div>
+ <pre class="prettyprint lang-config">
+UseCanonicalName Off
+VirtualDocumentRoot /usr/local/apache/vhosts/%0
+ </pre>
+
<p>A request for
<code>http://www.example.com/directory/file.html</code> will be
<code>vhosts</code> directory. To do this you might use the
following in your configuration file:</p>
- <div class="example"><p><code>
- UseCanonicalName Off<br />
- VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
- </code></p></div>
+ <pre class="prettyprint lang-config">
+UseCanonicalName Off
+VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
+ </pre>
+
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>
<p>A more even spread of files can be achieved by hashing from the
end of the name, for example: </p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2
-</code></p></div>
+</pre>
+
<p>The example request would come from
<code>/usr/local/apache/vhosts/example.com/n/i/a/domain/directory/file.html</code>.</p>
<p>Alternatively you might use: </p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
-</code></p></div>
+</pre>
+
<p>The example request would come from
<code>/usr/local/apache/vhosts/example.com/d/o/m/ain/directory/file.html</code>.</p>
<p>For IP-based virtual hosting you might use the following in
your configuration file:</p>
- <div class="example"><p><code>
- UseCanonicalName DNS<br />
- VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs<br />
- VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
- </code></p></div>
+ <pre class="prettyprint lang-config">
+UseCanonicalName DNS
+VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs
+VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
+ </pre>
+
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>
a <code>%</code> directive, you can work around the problem in
the following way:</p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0
-</code></p></div>
+</pre>
+
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>
information, you can set this default to help mod_xml2enc process
the data correctly. For example, to work with the default value
of Latin1 (<var>iso-8859-1</var> specified in HTTP/1.0, use</p>
- <div class="example"><p><code>xml2EncDefault iso-8859-1</code></p></div>
+ <pre class="prettyprint lang-config">xml2EncDefault iso-8859-1</pre>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>