<p>This document attempts to answer the commonly-asked questions about
setting up virtual hosts. These scenarios are those involving multiple
- web sites running on a single server, via <a href="name-based.html">name-based</a> or <a href="ip-based.html">IP-based</a> virtual hosts. A document should be
- coming soon about running sites on several servers behind a single
- proxy server.</p>
+ web sites running on a single server, via <a href="name-based.html">name-based</a> or <a href="ip-based.html">IP-based</a> virtual hosts.
+ </p>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#purename">Running several name-based web
hosts</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#mixed">Mixed name-based and IP-based
vhosts</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#proxy">Using <code>Virtual_host</code> and
+ mod_proxy together</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#default">Using <code>_default_</code>
vhosts</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#migrate">Migrating a name-based vhost to an
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
+<h2><a name="proxy" id="proxy">Using <code>Virtual_host</code> and
+ mod_proxy together</a></h2>
+
+ <p>The following example allows a front-end machine to proxy a
+ virtual host through to a server running on another machine. In the
+ example, a virtual host of the same name is configured on a machine
+ at <code>192.168.111.2</code>. The <code class="directive"><a href="../mod/mod_proxy.html#proxypreservehost on">ProxyPreserveHost On</a></code> directive is
+ used so that the desired hostname is passed through, in case we are
+ proxying multiple hostnames to a single machine.</p>
+
+ <div class="example"><p><code>
+ <VirtualHost *:*><br />
+ ProxyPreserveHost On<br />
+ ProxyPass / http://192.168.111.2<br />
+ ProxyPassReverse / http://192.168.111.2/<br />
+ ServerName hostname.example.com<br />
+ </VirtualHost>
+ </code></p></div>
+
+ </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
<h2><a name="default" id="default">Using <code>_default_</code>
vhosts</a></h2>
setting up virtual hosts. These scenarios are those involving multiple
web sites running on a single server, via <a
href="name-based.html">name-based</a> or <a
- href="ip-based.html">IP-based</a> virtual hosts. A document should be
- coming soon about running sites on several servers behind a single
- proxy server.</p>
+ href="ip-based.html">IP-based</a> virtual hosts.
+ </p>
</summary>
</section>
+ <section id="proxy"><title>Using <code>Virtual_host</code> and
+ mod_proxy together</title>
+
+ <p>The following example allows a front-end machine to proxy a
+ virtual host through to a server running on another machine. In the
+ example, a virtual host of the same name is configured on a machine
+ at <code>192.168.111.2</code>. The <directive
+ module="mod_proxy">ProxyPreserveHost On</directive> directive is
+ used so that the desired hostname is passed through, in case we are
+ proxying multiple hostnames to a single machine.</p>
+
+ <example>
+ <VirtualHost *:*><br />
+ ProxyPreserveHost On<br />
+ ProxyPass / http://192.168.111.2<br />
+ ProxyPassReverse / http://192.168.111.2/<br />
+ ServerName hostname.example.com<br />
+ </VirtualHost>
+ </example>
+
+ </section>
+
<section id="default"><title>Using <code>_default_</code>
vhosts</title>