⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_proxy.html

📁 这个是我在web培训时老师提供的手册
💻 HTML
📖 第 1 页 / 共 4 页
字号:
    <p><var>path</var>是本地虚拟路径的名称。<var>url</var>是远端服务器的部分URL。与<code class="directive"><a href="#proxypass">ProxyPass</a></code>指令中的使用方法相同。</p>

    <p>例如,假定本地服务器拥有地址<code>http://example.com/</code> ,那么</p>

    <div class="example"><p><code>
      ProxyPass         /mirror/foo/ http://backend.example.com/<br />
      ProxyPassReverse  /mirror/foo/ http://backend.example.com/<br />
      ProxyPassReverseCookieDomain  backend.example.com  public.example.com<br />
      ProxyPassReverseCookiePath  /  /mirror/foo/
    </code></p></div>

    <p>不仅会把所有对<code>http://example.com/mirror/foo/bar</code>的请求直接转换为对<code>http://backend.example.com/bar</code>的代理请求(由<code>ProxyPass</code>提供的功能),它还会重定向服务器<code>backend.example.com</code>的发送:当<code>http://backend.example.com/bar</code>被它重定向到<code>http://backend.example.com/quux</code>时,Apache会在转交HTTP重定向应答到客户端之前调整它为<code>http://example.com/mirror/foo/quux</code> 。注意:被用于构建URL的主机名与<code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code>指令的设置有关。</p>

    <p>注意,此<code class="directive">ProxyPassReverse</code>指令亦可与<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>的代理穿透特性(<code>RewriteRule ...  [P]</code>)联用。因为它不依赖于相应的<code class="directive"><a href="#proxypass">ProxyPass</a></code>指令。</p>

    <p>当在<code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code>配置段中使用时,第一个参数会被忽略而采用由<code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</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="ProxyPassReverseCookieDomain" id="ProxyPassReverseCookieDomain">ProxyPassReverseCookieDomain</a> <a name="proxypassreversecookiedomain" id="proxypassreversecookiedomain">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Adjusts the Domain string in Set-Cookie headers from a reverse-
proxied server</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyPassReverseCookieDomain <var>internal-domain</var> <var>public-domain</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
<p>Usage is basically similar to
<code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
rewriting headers that are a URL, this rewrites the <code>domain</code>
string in <code>Set-Cookie</code> headers.</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="ProxyPassReverseCookiePath" id="ProxyPassReverseCookiePath">ProxyPassReverseCookiePath</a> <a name="proxypassreversecookiepath" id="proxypassreversecookiepath">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Adjusts the Path string in Set-Cookie headers from a reverse-
proxied server</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyPassReverseCookiePath <var>internal-path</var> <var>public-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
<p>Usage is basically similar to
<code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
rewriting headers that are a URL, this rewrites the <code>path</code>
string in <code>Set-Cookie</code> headers.</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="ProxyPreserveHost" id="ProxyPreserveHost">ProxyPreserveHost</a> <a name="proxypreservehost" id="proxypreservehost">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>使用进入的HTTP请求头来发送代理请求</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyPreserveHost On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ProxyPreserveHost Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>仅在 Apache 2.0.31 及以后的版本中可用</td></tr>
</table>
    <p>当启用时,此选项将把传入请求的"Host:"行传递给被代理的主机,而不是传递在<code class="directive">ProxyPass</code>中指定的主机名。</p>

    <p>此选项一般为<code>Off</code>状态。It is mostly 
    useful in special configurations like proxied mass name-based virtual
    hosting, where the original Host header needs to be evaluated by the
    backend server.</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="ProxyReceiveBufferSize" id="ProxyReceiveBufferSize">ProxyReceiveBufferSize</a> <a name="proxyreceivebuffersize" id="proxyreceivebuffersize">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>代理HTTP和FTP连接的接收缓冲区大小(字节)</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyReceiveBufferSize <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ProxyReceiveBufferSize 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
    <p><code class="directive">ProxyReceiveBufferSize</code>指令为增加的吞吐量指定了代理HTTP和FTP连接的(TCP/IP)网络接收缓冲区。这个值必须大于<code>512</code> ,或设置为"<code>0</code>"表示使用系统默认的缓冲大小。</p>

    <div class="example"><h3>示例</h3><p><code>
      ProxyReceiveBufferSize 2048
    </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="ProxyRemote" id="ProxyRemote">ProxyRemote</a> <a name="proxyremote" id="proxyremote">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>用于处理某些特定请求的远端代理</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyRemote <var>match</var> <var>remote-server</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
    <p>此指令定义了此代理的远端代理。<var>match</var>可以是远端服务器支持的URL形式的名称、或是远端服务器使用的部分URL、或是代表服务器可以接受所有请求的"<code>*</code>"。<var>remote-server</var>是远端服务器的部分URL。语法为:</p>

    <div class="example"><p><code>
      <dfn>remote-server</dfn> = <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
    </code></p></div>

    <p><var>scheme</var>是与远端服务器交换信息时使用的协议;本模块暂时只支持<code>http</code>协议。</p>

    <div class="example"><h3>示例</h3><p><code>
      ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000<br />
      ProxyRemote * http://cleversite.com<br />
      ProxyRemote ftp http://ftpproxy.mydomain.com:8080
    </code></p></div>

    <p>在最后一个例子中,代理会将封装到另外一个HTTP代理请求中的FTP请求转交到另外一个能处理它们的代理去。</p>

    <p>此选项也支持反向代理配置:一个后端web服务器可以被嵌入到一个虚拟主机的URL空间中,哪怕它是由另一个代理转交过来的。</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="ProxyRemoteMatch" id="ProxyRemoteMatch">ProxyRemoteMatch</a> <a name="proxyremotematch" id="proxyremotematch">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>处理匹配正则表达式的请求的远端代理</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
    <p><code class="directive">ProxyRemoteMatch</code>与<code class="directive"><a href="#proxyremote">ProxyRemote</a></code>令基本相同。除了第一个参数是由一个请求的URL变成了匹配的<a class="glossarylink" href="../glossary.html#regex" title="see glossary">正则表达式</a>。</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="ProxyRequests" id="ProxyRequests">ProxyRequests</a> <a name="proxyrequests" id="proxyrequests">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>启用正向(标准)代理请求</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyRequests On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ProxyRequests Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
    <p>此指令将允许或禁止Apache作为正向代理服务器的功能(设置为<code>Off</code>并不会禁用<code class="directive"><a href="#proxypass">ProxyPass</a></code>指令)。</p>

    <p>在一个典型的反向代理配置中,此可选项一般设置为<code>Off</code>。</p>

    <p>为了能够代理HTTP或FTP站点,<code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>或<code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>必须同时存在于服务器中。</p>

    <div class="warning"><h3>警告</h3>
      <p>在您没有对服务器<a href="#access">采取安全措施</a>之前,请不要用<code class="directive"><a href="#proxyrequests">ProxyRequests</a></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="ProxyTimeout" id="ProxyTimeout">ProxyTimeout</a> <a name="proxytimeout" id="proxytimeout">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>代理请求的网络超时</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyTimeout <var>seconds</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ProxyTimeout 300</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>仅在 Apache 2.0.31 及以后的版本中可用</td></tr>
</table>
    <p>此指令允许用户对代理请求指定一个超时值。当你有一个很慢/错误多多的应用服务器经常挂起,而您宁愿返回一个超时的失败信息也不愿意继续等待不知道多久的时候,这个功能是很有用的。</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="ProxyVia" id="ProxyVia">ProxyVia</a> <a name="proxyvia" id="proxyvia">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>控制代理对<code>Via</code>应答头的使用</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ProxyVia On|Off|Full|Block</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ProxyVia Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_proxy</td></tr>
</table>
    <p>此指令控制代理对"<code>Via:</code>"头的使用。它的目的是控制位于代理服务器链中的代理请求的流向。参阅<a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>(HTTP/1.1)14.45小节以获得关于"<code>Via:</code>"头的解释。</p>

    <ul>
    <li>如果设置为默认值<code>Off</code> ,将不会采取特殊的处理。如果一个请求或应答包含"<code>Via:</code>"头,将不进行任何修改而直接通过。</li>

    <li>如果设置为<code>On</code>每个请求和应答都会对应当前主机得到一个"<code>Via:</code>"头。</li>

    <li>如果设置为<code>Full</code> ,每个产生的"<code>Via:</code>"头中都会额外加入Apache服务器的版本,以"<code>Via:</code>"注释域出现。</li>

    <li>如果设置为<code>Block</code> ,每个代理请求中的所有"<code>Via:</code>"头行都将被删除。且不会产生新的"<code>Via:</code>"头。</li>
    </ul>

</div>
</div>
<div id="footer">
<p class="apache">本文允许自由使用、分发、转载,但必须保留译者署名;详见:<a href="../translator_announcement.html#announcement">译者声明</a>。</p>
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p></div>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -