<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>Apache Virtual Host documentation - Apache HTTP Server Version 2.4</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet">
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size">
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css"><link rel="stylesheet" type="text/css" href="../style/css/prettify.css">
<script src="../style/scripts/prettify.min.js">
</script>

<link href="../images/favicon.png" rel="shortcut icon"></head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.png"></div>
<div class="up"><a href="../"><img title="<-" alt="<-" src="../images/left.gif"></a></div>
<div id="path">
<a href="https://www.apache.org/">Apache</a> &gt; <a href="https://httpd.apache.org/">HTTP Server</a> &gt; <a href="https://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>Apache Virtual Host documentation</h1>
<button aria-label="Toggle language list" class="lang-toggle"><svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="16" width="16"><circle r="10" cy="12" cx="12"/><line y2="12" x2="22" y1="12" x1="2"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></button>
<div class="toplang">
<p><span>Available Languages: </span><a href="../de/vhosts/" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="../en/vhosts/" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/vhosts/" hreflang="fr" rel="alternate" title="Fran&ccedil;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/vhosts/" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/vhosts/" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/vhosts/" hreflang="tr" rel="alternate" title="T&uuml;rk&ccedil;e">&nbsp;tr&nbsp;</a> |
<a href="../zh-cn/vhosts/" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div>


    <p>The term <cite>Virtual Host</cite> refers to the practice of
    running more than one web site (such as
    <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 href="name-based.html">name-based</a>", meaning that you have
    multiple names running on each IP address. The fact that they
    are running on the same physical server is not apparent to the
    end user.</p>

    <p>Apache was one of the first servers to support IP-based
    virtual hosts right out of the box. Versions 1.1 and later of
    Apache support both IP-based and name-based virtual hosts
    (vhosts). The latter variant of virtual hosts is sometimes also
    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 HTTP Server:</p>

</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif"> <a href="#support">Virtual Host Support</a></li>
<li><img alt="" src="../images/down.gif"> <a href="#directives">Configuration directives</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><code class="module"><a href="../mod/mod_vhost_alias.html">mod_vhost_alias</a></code></li><li><a href="name-based.html">Name-based virtual
hosts</a></li><li><a href="ip-based.html">IP-based virtual hosts</a></li><li><a href="examples.html">Virtual host examples</a></li><li><a href="fd-limits.html">File descriptor limits</a></li><li><a href="mass.html">Mass virtual hosting</a></li><li><a href="details.html">Details of host matching</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div>
<div class="section">
<h2 id="support">Virtual Host Support <a title="Permanent link" href="#support" class="permalink">&para;</a></h2>

    <ul>
      <li><a href="name-based.html">Name-based Virtual Hosts</a> (More
      than one web site per IP address)</li>
      <li><a href="ip-based.html">IP-based Virtual Hosts</a> (An IP
      address for each web site)</li>
      <li><a href="examples.html">Virtual Host examples for common
      setups</a></li>
      <li><a href="fd-limits.html">File Descriptor Limits</a> (or,
      <em>Too many log files</em>)</li>
      <li><a href="mass.html">Dynamically Configured Mass Virtual
      Hosting</a></li>
      <li><a href="details.html">In-Depth Discussion of Virtual Host
      Matching</a></li>
    </ul>

</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div>
<div class="section">
<h2 id="directives">Configuration directives <a title="Permanent link" href="#directives" class="permalink">&para;</a></h2>

    <ul>
      <li><code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code></li>
      <li><code class="directive"><a href="../mod/core.html#servername">ServerName</a></code></li>
      <li><code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code></li>
      <li><code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code></li>
    </ul>

    <p>If you are trying to debug your virtual host configuration, you
    may find the <code>-S</code> command line switch
    useful.</p>

    <div class="example"><h3>Unix example</h3><p><code>
    
    apachectl -S
    </code></p></div>

    <div class="example"><h3>Windows example</h3><p><code>
    
    httpd.exe -S
    </code></p></div>


    <p>This command will dump out a description of how Apache parsed
    the configuration file. Careful examination of the IP addresses and
    server names may help uncover configuration mistakes. (See
    the docs for the <code class="program"><a href="../programs/httpd.html">httpd</a></code> program for
    other command line options)</p>

</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../de/vhosts/" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="../en/vhosts/" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/vhosts/" hreflang="fr" rel="alternate" title="Fran&ccedil;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/vhosts/" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/vhosts/" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/vhosts/" hreflang="tr" rel="alternate" title="T&uuml;rk&ccedil;e">&nbsp;tr&nbsp;</a> |
<a href="../zh-cn/vhosts/" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2026 The Apache Software Foundation.<br>Licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p></div><script><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
    prettyPrint();
}
var langToggle = document.querySelector('.lang-toggle');
var topLang = document.querySelector('.toplang');
if (langToggle && topLang) {
    langToggle.addEventListener('click', function() { topLang.classList.toggle('open'); });
}
var qv = document.getElementById('quickview');
if (qv) {
    document.body.appendChild(qv);
    var qvBtn = document.createElement('button');
    qvBtn.className = 'qv-toggle';
    qvBtn.setAttribute('aria-label', 'Toggle page navigation');
    qvBtn.innerHTML = '&#9776;';
    document.body.appendChild(qvBtn);
    qvBtn.addEventListener('click', function() {
        var isOpen = qv.classList.toggle('open');
        if (isOpen) {
            qv.style.top = window.scrollY + 10 + 'px';
        }
    });
    window.addEventListener('scroll', function() { qv.classList.remove('open'); });
}
//--><!]]></script>
</body></html>