ip-based.html.en revision 5ae30adbe59946de742ab0cd6be3b7457471a698
97a9a944b5887e91042b019776c41d5dd74557aferikabele<?xml version="1.0" encoding="ISO-8859-1"?>
97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
97a9a944b5887e91042b019776c41d5dd74557aferikabele<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki This file is generated from xml source: DO NOT EDIT
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd -->
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<title>Apache IP-based Virtual Host Support - Apache HTTP Server</title>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<body id="manual-page"><div id="page-header">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<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>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<p class="apache">Apache HTTP Server Version 2.3</p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<img alt="" src="/images/feather.gif" /></div>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<div id="path">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<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/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Virtual Hosts</a></div><div id="page-content"><div id="preamble"><h1>Apache IP-based Virtual Host Support</h1>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div class="toplang">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English">&nbsp;en&nbsp;</a> |
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
7dc5a2d4a0c77f5bf5a95de92d68e43de7d8117anilgun<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung</div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#requirements">System requirements</a></li>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<li><img alt="" src="/images/down.gif" /> <a href="#howto">How to set up Apache</a></li>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<li><img alt="" src="/images/down.gif" /> <a href="#multiple">Setting up multiple daemons</a></li>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<li><img alt="" src="/images/down.gif" /> <a href="#single">Setting up a single daemon
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen with virtual hosts</a></li>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd</ul><h3>See also</h3><ul class="seealso"><li>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<a href="name-based.html">Name-based Virtual Hosts Support</a>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf</li></ul></div>
f19fa851b976a05691dea05be46586aa5aadeba2rbowen<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<div class="section">
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin<h2><a name="requirements" id="requirements">System requirements</a></h2>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>As the term <cite>IP-based</cite> indicates, the server
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <strong>must have a different IP address for each IP-based
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin virtual host</strong>. This can be achieved by the machine
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf having several physical network connections, or by use of
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin virtual interfaces which are supported by most modern operating
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin systems (see system documentation for details, these are
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf frequently called "ip aliases", and the "ifconfig" command is
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf most commonly used to set them up).</p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin<div class="section">
06ba4a61654b3763ad65f52283832ebf058fdf1cslive<h2><a name="howto" id="howto">How to set up Apache</a></h2>
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowen
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowen <p>There are two ways of configuring apache to support multiple
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd hosts. Either by running a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> daemon for
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd each hostname, or by running a single daemon which supports all the
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd virtual hosts.</p>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
117c1f888a14e73cdd821dc6c23eb0411144a41cnd <p>Use multiple daemons when:</p>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd
117c1f888a14e73cdd821dc6c23eb0411144a41cnd <ul>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd <li>There are security partitioning issues, such as company1
117c1f888a14e73cdd821dc6c23eb0411144a41cnd does not want anyone at company2 to be able to read their
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd data except via the web. In this case you would need two
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf 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>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf
7571ea383299910bead3e93e66246cb212a28d0figalic <li>You can afford the memory and file descriptor
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf requirements of listening to every IP alias on the
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf machine. It's only possible to <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf address, or to specific addresses. So if you have a need to
7571ea383299910bead3e93e66246cb212a28d0figalic listen to a specific address for whatever reason, then you
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf will need to listen to all specific addresses. (Although one
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf <code class="program"><a href="/programs/httpd.html">httpd</a></code> could listen to N-1 of the addresses, and another could
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf listen to the remaining address.)</li>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf </ul>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf <p>Use a single daemon when:</p>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf <ul>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf <li>Sharing of the httpd configuration between virtual hosts
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf is acceptable.</li>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf
1f0a28764a0520e43ce3a9130e56236fd67cd568igalic <li>The machine services a large number of requests, and so
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf the performance loss in running separate daemons may be
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf significant.</li>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf </ul>
1e6708ac9aebbbd0ff63c2b93e6b97d50263a8bbrbowen
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin<div class="section">
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen<h2><a name="multiple" id="multiple">Setting up multiple daemons</a></h2>
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen <p>Create a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> installation for each
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen virtual host. For each installation, use the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directive in the
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen configuration file to select which IP address (or virtual host)
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen that daemon services. e.g.</p>
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen <div class="example"><p><code>
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen Listen www.smallco.com:80
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen </code></p></div>
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen <p>It is recommended that you use an IP address instead of a
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen
9b3696c7ad70387ecd46e0f061b99d381dc392f9rbowen</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sf<div class="section">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<h2><a name="single" id="single">Setting up a single daemon
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd with virtual hosts</a></h2>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd <p>For this case, a single <code class="program"><a href="/programs/httpd.html">httpd</a></code> will service
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd requests for the main server and all the virtual hosts. The <code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code> directive
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin 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>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd or <code class="directive"><a href="/mod/mod_log_config.html#customlog">CustomLog</a></code>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd configuration directives to different values for each virtual
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd host. e.g.</p>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd <div class="example"><p><code>
06f0540592b1d6fc148e1ec9afc95ce48162db18covener &lt;VirtualHost www.smallco.com&gt;<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ServerAdmin webmaster@mail.smallco.com<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener DocumentRoot /groups/smallco/www<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ServerName www.smallco.com<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ErrorLog /groups/smallco/logs/error_log<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener TransferLog /groups/smallco/logs/access_log<br />
b9bf3918f6eaf7747bcbfbd02792bcbe4a052784nilgun &lt;/VirtualHost&gt;<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener <br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener &lt;VirtualHost www.baygroup.org&gt;<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ServerAdmin webmaster@mail.baygroup.org<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener DocumentRoot /groups/baygroup/www<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ServerName www.baygroup.org<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener ErrorLog /groups/baygroup/logs/error_log<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener TransferLog /groups/baygroup/logs/access_log<br />
06f0540592b1d6fc148e1ec9afc95ce48162db18covener &lt;/VirtualHost&gt;
06f0540592b1d6fc148e1ec9afc95ce48162db18covener </code></p></div>
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin <p>It is recommended that you use an IP address instead of a
06f0540592b1d6fc148e1ec9afc95ce48162db18covener hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
06f0540592b1d6fc148e1ec9afc95ce48162db18covener <p>Almost <strong>any</strong> configuration directive can be
06f0540592b1d6fc148e1ec9afc95ce48162db18covener put in the VirtualHost directive, with the exception of
06f0540592b1d6fc148e1ec9afc95ce48162db18covener directives that control process creation and a few other
97a9a944b5887e91042b019776c41d5dd74557aferikabele directives. To find out if a directive can be used in the
06f0540592b1d6fc148e1ec9afc95ce48162db18covener VirtualHost directive, check the <a href="/mod/directive-dict.html#Context">Context</a> using the
06f0540592b1d6fc148e1ec9afc95ce48162db18covener <a href="/mod/directives.html">directive index</a>.</p>
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p><code class="directive"><a href="/mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener may be used inside a
06f0540592b1d6fc148e1ec9afc95ce48162db18covener VirtualHost directive if the <a href="/suexec.html">suEXEC
06f0540592b1d6fc148e1ec9afc95ce48162db18covener wrapper</a> is used.</p>
97a9a944b5887e91042b019776c41d5dd74557aferikabele
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p><em>SECURITY:</em> When specifying where to write log files,
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd be aware of some security risks which are present if anyone
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd other than the user that starts Apache has write access to the
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd directory where they are written. See the <a href="/misc/security_tips.html">security tips</a> document
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd for details.</p>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd</div></div>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<div class="bottomlang">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English">&nbsp;en&nbsp;</a> |
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd</div><div id="footer">
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<p class="apache">Copyright 2008 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>
fa0f379e3845907d7c1087d885169e302239bdbbnd<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>
fa0f379e3845907d7c1087d885169e302239bdbbnd</body></html>