<p>The term <cite>Virtual Host</cite> refers to the practice of
running more than one web site (such as
- <code>www.company1.com</code> and <code>www.company2.com</code>)
+ <code>company1.example.com</code> and <code>company2.example.com</code>)
on a single machine. Virtual hosts can be "<a
href="ip-based.html">IP-based</a>", meaning that you have a
different IP address for every web site, or "<a
called <em>host-based</em> or <em>non-IP virtual hosts</em>.</p>
<p>Below is a list of documentation pages which explain all
- details of virtual host support in Apache version 1.3 and
- later.</p>
+ details of virtual host support in Apache HTTP Server:</p>
</summary>
<section id="directives"><title>Configuration directives</title>
<ul>
+ <li><directive module="core">NameVirtualHost</directive></li>
<li><directive type="section"
module="core">VirtualHost</directive></li>
- <li><directive module="core">NameVirtualHost</directive></li>
<li><directive module="core">ServerName</directive></li>
<li><directive module="core">ServerAlias</directive></li>
<li><directive module="core">ServerPath</directive></li>
<a href="name-based.html">Name-based Virtual Hosts Support</a>
</seealso>
+<section id="explanation"><title>What is IP-based virtual hosting</title>
+<p>IP-based virtual hosting is a method to apply different directives
+based on the IP address and port a request is received on. Most commonly,
+this is used to serve different websites on different ports or interfaces.</p>
+
+<p>In many cases, <a href="name-based.html">name-based
+virtual hosts</a> are more convenient, because they allow
+many virtual hosts to share a single address/port.
+See <a href="name-based.html#namevip">Name-based vs. IP-based
+Virtual Hosts</a> to help you decide. </p>
+</section>
+
<section id="requirements"><title>System requirements</title>
<p>As the term <cite>IP-based</cite> indicates, the server
- <strong>must have a different IP address for each IP-based
+ <strong>must have a different IP address/port combination for each IP-based
virtual host</strong>. This can be achieved by the machine
having several physical network connections, or by use of
virtual interfaces which are supported by most modern operating
systems (see system documentation for details, these are
frequently called "ip aliases", and the "ifconfig" command is
- most commonly used to set them up).</p>
+ most commonly used to set them up), and/or using multiple
+ port numbers.</p>
+
+ <p> In the terminology of Apache HTTP Server, using a single IP address
+ but multiple TCP ports, is also IP-based virtual hosting.</p>
</section>
</section>
<section id="single"><title>Setting up a single daemon
- with virtual hosts</title>
+ with virtual hosts</title>
<p>For this case, a single <program>httpd</program> will service
requests for the main server and all the virtual hosts. The <directive
ErrorLog /groups/smallco/logs/error_log<br />
TransferLog /groups/smallco/logs/access_log<br />
</VirtualHost><br />
- <br />
+ <br />
<VirtualHost 192.168.0.2:80><br />
ServerAdmin webmaster@baygroup.example.org<br />
DocumentRoot /groups/baygroup/www<br />
ServerName baygroup.example.com<br />
ErrorLog /groups/baygroup/logs/error_log<br />
TransferLog /groups/baygroup/logs/access_log<br />
- </VirtualHost>
- </example>
+</VirtualHost>
+ </example>
<p>It is recommended that you use an IP address instead of a
- hostname (see <a href="../dns-caveats.html">DNS caveats</a>).</p>
+ hostname in the <VirtualHost> directive
+ (see <a href="../dns-caveats.html">DNS caveats</a>).</p>
+
+ <p> Specific IP addresses or ports have precedence over their wildcard
+ equivalents, and any virtual host that matches has precedence over
+ the servers base configuration.</p>
<p>Almost <strong>any</strong> configuration directive can be
put in the VirtualHost directive, with the exception of