📄 mod_proxy.html.en
字号:
<p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so it can result in more effective apache performance.</p> </div></dd> <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt> <dd> <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the DNS domain name service. It represents a logical host (in contrast to <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p> <div class="example"><h3>Examples</h3><p><code> prep.ai.example.com<br /> www.apache.org </code></p></div> <div class="note"><h3>Note</h3> <p>In many situations, it is more effective to specify an <var><a href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a DNS lookup can be avoided. Name resolution in Apache can take a remarkable deal of time when the connection to the name server uses a slow PPP link.</p> <p><var>Hostname</var> comparisons are done without regard to the case, and <var>Hostname</var>s are always assumed to be anchored in the root of the DNS tree, therefore two hosts <code>WWW.ExAmple.com</code> and <code>www.example.com.</code> (note the trailing period) are considered equal.</p> </div></dd> </dl><h3>See also</h3><ul><li><a href="../dns-caveats.html">DNS Issues</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Proxy" id="Proxy"><Proxy></a> <a name="proxy" id="proxy">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to proxied resources</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Proxy <var>wildcard-url</var>> ...</Proxy></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr></table> <p>Directives placed in <code class="directive"><Proxy></code> sections apply only to matching proxied content. Shell-style wildcards are allowed.</p> <p>For example, the following will allow only hosts in <code>yournetwork.example.com</code> to access content via your proxy server:</p> <div class="example"><p><code> <Proxy *><br /> <span class="indent"> Order Deny,Allow<br /> Deny from all<br /> Allow from yournetwork.example.com<br /> </span> </Proxy> </code></p></div> <p>The following example will process all files in the <code>foo</code> directory of <code>example.com</code> through the <code>INCLUDES</code> filter when they are sent through the proxy server:</p> <div class="example"><p><code> <Proxy http://example.com/foo/*><br /> <span class="indent"> SetOutputFilter INCLUDES<br /> </span> </Proxy> </code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyBadHeader" id="ProxyBadHeader">ProxyBadHeader</a> <a name="proxybadheader" id="proxybadheader">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines how to handle bad header lines in aresponse</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBadHeader IsError|Ignore|StartBody</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyBadHeader IsError</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.44 and later</td></tr></table> <p>The <code class="directive">ProxyBadHeader</code> directive determines the behaviour of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> if it receives syntactically invalid header lines (<em>i.e.</em> containing no colon). The following arguments are possible:</p> <dl> <dt><code>IsError</code></dt> <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is the default behaviour.</dd> <dt><code>Ignore</code></dt> <dd>Treat bad header lines as if they weren't sent.</dd> <dt><code>StartBody</code></dt> <dd>When receiving the first bad header line, finish reading the headers and treat the remainder as body. This helps to work around buggy backend servers which forget to insert an empty line between the headers and the body.</dd> </dl></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyBlock" id="ProxyBlock">ProxyBlock</a> <a name="proxyblock" id="proxyblock">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Words, hosts, or domains that are banned from beingproxied</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>[<var>word</var>|<var>host</var>|<var>domain</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr></table> <p>The <code class="directive">ProxyBlock</code> directive specifies a list of words, hosts and/or domains, separated by spaces. HTTP, HTTPS, and FTP document requests to sites whose names contain matched words, hosts or domains are <em>blocked</em> by the proxy server. The proxy module will also attempt to determine IP addresses of list items which may be hostnames during startup, and cache them for match test as well. That may slow down the startup time of the server.</p> <div class="example"><h3>Example</h3><p><code> ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu </code></p></div> <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by IP address.</p> <p>Note that <code>wotsamattau</code> would also be sufficient to match <code>wotsamattau.edu</code>.</p> <p>Note also that</p> <div class="example"><p><code> ProxyBlock * </code></p></div> <p>blocks connections to all sites.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyDomain" id="ProxyDomain">ProxyDomain</a> <a name="proxydomain" id="proxydomain">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default domain name for proxied requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyDomain <var>Domain</var></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr></table> <p>This directive is only useful for Apache proxy servers within intranets. The <code class="directive">ProxyDomain</code> directive specifies the default domain which the apache proxy server will belong to. If a request to a host without a domain name is encountered, a redirection response to the same host with the configured <var>Domain</var> appended will be generated.</p> <div class="example"><h3>Example</h3><p><code> ProxyRemote * http://firewall.example.com:81<br /> NoProxy .example.com 192.168.112.0/21<br /> ProxyDomain .example.com </code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyErrorOverride" id="ProxyErrorOverride">ProxyErrorOverride</a> <a name="proxyerroroverride" id="proxyerroroverride">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override error pages for proxied content</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyErrorOverride On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyErrorOverride Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0 and later</td></tr></table> <p>This directive is useful for reverse-proxy setups, where you want to have a common look and feel on the error pages seen by the end user. This also allows for included files (via <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>'s SSI) to get the error code and act accordingly (default behavior would display the error page of the proxied server, turning this on shows the SSI Error message).</p> <p>This directive does not affect the processing of informational (1xx), normal success (2xx), or redirect (3xx) responses.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyFtpDirCharset" id="ProxyFtpDirCharset">ProxyFtpDirCharset</a> <a name="proxyftpdircharset" id="proxyftpdircharset">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define the character set for proxied FTP listings</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyFtpDirCharset <var>character set</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyFtpDirCharset ISO-8859-1</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2.7 and later</td></tr></table> <p>The <code class="directive">ProxyFtpDirCharset</code> directive defines the character set to be set for FTP directory listings in HTML generated by <code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyIOBufferSize" id="ProxyIOBufferSize">ProxyIOBufferSize</a> <a name="proxyiobuffersize" id="proxyiobuffersize">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine size of internal data throughput buffer</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyIOBufferSize <var>bytes</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyIOBufferSize 8192</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr></table> <p>The <code class="directive">ProxyIOBufferSize</code> directive adjusts the size of the internal buffer, which is used as a scratchpad for the data between input and output. The size must be less or equal <code>8192</code>.</p> <p>In almost every case there's no reason to change that value.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -