ip-based.html.en revision 35714556a25fceb7c9bf9c4e01791b2e2a4c27c3
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<?xml version="1.0" encoding="ISO-8859-1"?>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess This file is generated from xml source: DO NOT EDIT
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5a58787efeb02a1c3f06569d019ad81fd2efa06end -->
5a58787efeb02a1c3f06569d019ad81fd2efa06end<title>Apache IP-based Virtual Host Support - Apache HTTP Server</title>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<body id="manual-page"><div id="page-header">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="apache">Apache HTTP Server Version 2.1</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<img alt="" src="/images/feather.gif" /></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div id="path">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Virtual Hosts</a></div><div id="page-content"><div id="preamble"><h1>Apache IP-based Virtual Host Support</h1>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="toplang">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English">&nbsp;en&nbsp;</a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd</div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd</div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#requirements">System requirements</a></li>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<li><img alt="" src="/images/down.gif" /> <a href="#howto">How to set up Apache</a></li>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen<li><img alt="" src="/images/down.gif" /> <a href="#multiple">Setting up multiple daemons</a></li>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen<li><img alt="" src="/images/down.gif" /> <a href="#single">Setting up a single daemon
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen with virtual hosts</a></li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess</ul><h3>See also</h3><ul class="seealso"><li>
0e13d2a04f8c7cb647556e890bb69d5789a31ce1nd<a href="name-based.html">Name-based Virtual Hosts Support</a>
0e13d2a04f8c7cb647556e890bb69d5789a31ce1nd</li></ul></div>
2bd55c0d474884fe40c4a081efcbd82bc1c913a8rbowen<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b21197dc8e6b8c764fdcc24d4bae8b0eebb6bc4end<div class="section">
2bd55c0d474884fe40c4a081efcbd82bc1c913a8rbowen<h2><a name="requirements" id="requirements">System requirements</a></h2>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen <p>As the term <cite>IP-based</cite> indicates, the server
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen <strong>must have a different IP address for each IP-based
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen virtual host</strong>. This can be achieved by the machine
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen having several physical network connections, or by use of
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen virtual interfaces which are supported by most modern operating
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen systems (see system documentation for details, these are
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen frequently called "ip aliases", and the "ifconfig" command is
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen most commonly used to set them up).</p>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="section">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="howto" id="howto">How to set up Apache</a></h2>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
be809bbd44119f26f27a701f6912d21f334d85ffrbowen <p>There are two ways of configuring apache to support multiple
ae89c529be7bde57cc051ec8f85da6fddd502926erikabele hosts. Either by running a separate httpd daemon for each
5a58787efeb02a1c3f06569d019ad81fd2efa06end hostname, or by running a single daemon which supports all the
5a58787efeb02a1c3f06569d019ad81fd2efa06end virtual hosts.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen <p>Use multiple daemons when:</p>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen
2bd55c0d474884fe40c4a081efcbd82bc1c913a8rbowen <ul>
2bd55c0d474884fe40c4a081efcbd82bc1c913a8rbowen <li>There are security partitioning issues, such as company1
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen does not want anyone at company2 to be able to read their
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen data except via the web. In this case you would need two
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess 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>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen <li>You can afford the memory and file descriptor
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen requirements of listening to every IP alias on the
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen machine. It's only possible to <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen address, or to specific addresses. So if you have a need to
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess listen to a specific address for whatever reason, then you
10ca15b877e1d7f36b5d4ccd0a38e984cd635da4rbowen will need to listen to all specific addresses. (Although one
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen httpd could listen to N-1 of the addresses, and another could
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen listen to the remaining address.)</li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end </ul>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>Use a single daemon when:</p>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen <ul>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <li>Sharing of the httpd configuration between virtual hosts
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess is acceptable.</li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <li>The machine services a large number of requests, and so
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess the performance loss in running separate daemons may be
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen significant.</li>
2eaf662cbc81e823e8d9aeb8d54e69e63032493erbowen </ul>
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen
b55e805b1e1f5258452901038edc7097056eba7eerikabele</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen<div class="section">
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen<h2><a name="multiple" id="multiple">Setting up multiple daemons</a></h2>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
1855f4a7304fe643dd91b222128facaa185753e8erikabele <p>Create a separate httpd installation for each virtual host. For
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess each installation, use the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directive in the
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess configuration file to select which IP address (or virtual host)
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen that daemon services. e.g.</p>
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen
9bcfc3697a91b5215893a7d0206865b13fc72148nd <div class="example"><p><code>
9bcfc3697a91b5215893a7d0206865b13fc72148nd Listen www.smallco.com:80
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen </code></p></div>
48160cfe05c7614376dc7b1f57f5493eb73f06dbrbowen
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>It is recommended that you use an IP address instead of a
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<div class="section">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<h2><a name="single" id="single">Setting up a single daemon
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd with virtual hosts</a></h2>
b95ae799514ad86a15610ad75808d7065e9847c9kess
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>For this case, a single httpd will service requests for the
5a58787efeb02a1c3f06569d019ad81fd2efa06end 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
host. e.g.</p>
<div class="example"><p><code>
&lt;VirtualHost www.smallco.com&gt;<br />
ServerAdmin webmaster@mail.smallco.com<br />
DocumentRoot /groups/smallco/www<br />
ServerName www.smallco.com<br />
ErrorLog /groups/smallco/logs/error_log<br />
TransferLog /groups/smallco/logs/access_log<br />
&lt;/VirtualHost&gt;<br />
<br />
&lt;VirtualHost www.baygroup.org&gt;<br />
ServerAdmin webmaster@mail.baygroup.org<br />
DocumentRoot /groups/baygroup/www<br />
ServerName www.baygroup.org<br />
ErrorLog /groups/baygroup/logs/error_log<br />
TransferLog /groups/baygroup/logs/access_log<br />
&lt;/VirtualHost&gt;
</code></p></div>
<p>It is recommended that you use an IP address instead of a
hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
<p>Almost <strong>any</strong> configuration directive can be
put in the VirtualHost directive, with the exception of
directives that control process creation and a few other
directives. To find out if a directive can be used in the
VirtualHost directive, check the <a href="/mod/directive-dict.html#Context">Context</a> using the
<a href="/mod/directives.html">directive index</a>.</p>
<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">&nbsp;en&nbsp;</a> |
<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://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/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
</body></html>