<h2><a name="howto" id="howto">How to set up Apache</a></h2>
<p>There are two ways of configuring apache to support multiple
hosts. Either by running a separate httpd daemon for each
hostname, or by running a single daemon which supports all the
virtual hosts.</p>
<p>Use multiple daemons when:</p>
<ul>
<li>There are security partitioning issues, such as company1
does not want anyone at company2 to be able to read their
data except via the web. In this case you would need two
daemons, each running with different <code class="directive"><a href="../mod/mpm_common.html#user">User</a></code>, <code class="directive"><a href="../mod/mpm_common.html#group">Group</a></code>, <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>, and <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> settings.</li>
<li>You can afford the memory and <a href="../misc/descriptors.html">file descriptor
requirements</a> of listening to every IP alias on the
machine. It's only possible to <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
address, or to specific addresses. So if you have a need to
listen to a specific address for whatever reason, then you
will need to listen to all specific addresses. (Although one
httpd could listen to N-1 of the addresses, and another could
listen to the remaining address.)</li>
</ul>
<p>Use a single daemon when:</p>
<ul>
<li>Sharing of the httpd configuration between virtual hosts
is acceptable.</li>
<li>The machine services a large number of requests, and so
the performance loss in running separate daemons may be
<h2><a name="single" id="single">Setting up a single daemon
with virtual hosts</a></h2>
<p>For this case, a single httpd will service requests for the
main server and all the virtual hosts. The <code class="directive"><a href="../mod/core.html#virtualhost">VirtualHost</a></code> directive
in the configuration file is used to set the values of <code class="directive"><a href="../mod/core.html#serveradmin">ServerAdmin</a></code>, <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>, <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>, <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>
or <code class="directive"><a href="../mod/mod_log_config.html#customlog">CustomLog</a></code>
configuration directives to different values for each virtual
<p><code class="directive"><a href="../mod/mpm_common.html#user">User</a></code> and <code class="directive"><a href="../mod/mpm_common.html#group">Group</a></code> may be used inside a
VirtualHost directive if the <a href="../suexec.html">suEXEC
wrapper</a> is used.</p>
<p><em>SECURITY:</em> When specifying where to write log files,
be aware of some security risks which are present if anyone
other than the user that starts Apache has write access to the
directory where they are written. See the <a href="../misc/security_tips.html">security tips</a> document
for details.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/vhosts/ip-based.html" title="English"> en </a> |
<a href="../ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div><div id="footer">
<p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>