ip-based.html.en revision b95ae799514ad86a15610ad75808d7065e9847c9
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><!--
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive This file is generated from xml source: DO NOT EDIT
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b686b6a420bde7f78c416b90be11db94cb789979nd<title>Apache IP-based Virtual Host Support - Apache HTTP Server</title>
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
b686b6a420bde7f78c416b90be11db94cb789979nd<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>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.1</a> > <a href="./">Virtual Hosts</a></div><div id="page-content"><div id="preamble"><h1>Apache IP-based Virtual Host Support</h1>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English"> en </a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#requirements">System requirements</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/down.gif" /> <a href="#howto">How to set up Apache</a></li>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive<li><img alt="" src="/images/down.gif" /> <a href="#multiple">Setting up multiple daemons</a></li>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive<li><img alt="" src="/images/down.gif" /> <a href="#single">Setting up a single daemon
06ba4a61654b3763ad65f52283832ebf058fdf1cslive<a href="name-based.html">Name-based Virtual Hosts Support</a>
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5b10fd3977e6dfff19afe770e612e276962f7950nd<h2><a name="requirements" id="requirements">System requirements</a></h2>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd <p>As the term <cite>IP-based</cite> indicates, the server
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd <strong>must have a different IP address for each IP-based
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd virtual host</strong>. This can be achieved by the machine
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd having several physical network connections, or by use of
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd virtual interfaces which are supported by most modern operating
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd systems (see system documentation for details, these are
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd frequently called "ip aliases", and the "ifconfig" command is
5b10fd3977e6dfff19afe770e612e276962f7950nd most commonly used to set them up).</p>
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
2aff288113d772cedca6add888eb643afffe9fb1nd<h2><a name="howto" id="howto">How to set up Apache</a></h2>
2aff288113d772cedca6add888eb643afffe9fb1nd <p>There are two ways of configuring apache to support multiple
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd hosts. Either by running a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> daemon for
7fa75a06a4fee19e995c069ee00310455d1452e1pquerna each hostname, or by running a single daemon which supports all the
7fa75a06a4fee19e995c069ee00310455d1452e1pquerna virtual hosts.</p>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd <li>There are security partitioning issues, such as company1
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd does not want anyone at company2 to be able to read their
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd data except via the web. In this case you would need two
2aff288113d772cedca6add888eb643afffe9fb1nd 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>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd <li>You can afford the memory and file descriptor
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd requirements of listening to every IP alias on the
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd machine. It's only possible to <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
2aff288113d772cedca6add888eb643afffe9fb1nd address, or to specific addresses. So if you have a need to
2aff288113d772cedca6add888eb643afffe9fb1nd listen to a specific address for whatever reason, then you
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd will need to listen to all specific addresses. (Although one
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd <code class="program"><a href="/programs/httpd.html">httpd</a></code> could listen to N-1 of the addresses, and another could
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd listen to the remaining address.)</li>
2aff288113d772cedca6add888eb643afffe9fb1nd <li>Sharing of the httpd configuration between virtual hosts
2aff288113d772cedca6add888eb643afffe9fb1nd is acceptable.</li>
2aff288113d772cedca6add888eb643afffe9fb1nd <li>The machine services a large number of requests, and so
2aff288113d772cedca6add888eb643afffe9fb1nd the performance loss in running separate daemons may be
2aff288113d772cedca6add888eb643afffe9fb1nd significant.</li>
aa0b2780958e9b1467c9d0153a05738e399811a5nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
42af92a661a06b3cebc88d585aad75064a309d51nd<h2><a name="multiple" id="multiple">Setting up multiple daemons</a></h2>
2aff288113d772cedca6add888eb643afffe9fb1nd <p>Create a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> installation for each
aa0b2780958e9b1467c9d0153a05738e399811a5nd virtual host. For each installation, use the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directive in the
2aff288113d772cedca6add888eb643afffe9fb1nd configuration file to select which IP address (or virtual host)
2aff288113d772cedca6add888eb643afffe9fb1nd <p>It is recommended that you use an IP address instead of a
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
2aff288113d772cedca6add888eb643afffe9fb1nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
2aff288113d772cedca6add888eb643afffe9fb1nd<h2><a name="single" id="single">Setting up a single daemon
2aff288113d772cedca6add888eb643afffe9fb1nd <p>For this case, a single <code class="program"><a href="/programs/httpd.html">httpd</a></code> will service
e67fa8d3f161e595dd448fc24a591ee17ae59131nd requests for the main server and all the virtual hosts. The <code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code> directive
05ede5110427cb9dc071cc671d5aaba5d3b88c79nd 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>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd or <code class="directive"><a href="/mod/mod_log_config.html#customlog">CustomLog</a></code>
bf94bedcb62d7f0b926f4286069def5ee6b07b60nd configuration directives to different values for each virtual
ee5db395bc3723609919edfa96af387eea37c491jim ServerAdmin webmaster@mail.smallco.com<br />
2aff288113d772cedca6add888eb643afffe9fb1nd </VirtualHost><br />
7f3fdc63be07f2ad39e01a44e68e9324998a5c03slive ServerAdmin webmaster@mail.baygroup.org<br />
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd </VirtualHost>
7d15331eeb5429d7148d13d6fd914a641bf1c000pquerna <p>It is recommended that you use an IP address instead of a
2aff288113d772cedca6add888eb643afffe9fb1nd hostname (see <a href="/dns-caveats.html">DNS caveats</a>).</p>
2aff288113d772cedca6add888eb643afffe9fb1nd <p>Almost <strong>any</strong> configuration directive can be
2aff288113d772cedca6add888eb643afffe9fb1nd put in the VirtualHost directive, with the exception of
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd directives that control process creation and a few other
08842292d2f1550b40ae73e0dafc7641c5955c82nd directives. To find out if a directive can be used in the
2aff288113d772cedca6add888eb643afffe9fb1nd VirtualHost directive, check the <a href="/mod/directive-dict.html#Context">Context</a> using the
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd <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
2aff288113d772cedca6add888eb643afffe9fb1nd VirtualHost directive if the <a href="/suexec.html">suEXEC
2aff288113d772cedca6add888eb643afffe9fb1nd <p><em>SECURITY:</em> When specifying where to write log files,
2aff288113d772cedca6add888eb643afffe9fb1nd be aware of some security risks which are present if anyone
2aff288113d772cedca6add888eb643afffe9fb1nd other than the user that starts Apache has write access to the
80d3dc69b0e6ad772135f6a78af3d16bd6cccc42nd directory where they are written. See the <a href="/misc/security_tips.html">security tips</a> document
c023f60e35022146373e40249f0c8c8d623b6fcfnd for details.</p>
101bf3584c853027d9e51df6edfff5ff70c80238jim<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English"> en </a> |
73ba54c33b4fcad0e13005e10ea8648c9fe4265bnd<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
73ba54c33b4fcad0e13005e10ea8648c9fe4265bnd<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
73ba54c33b4fcad0e13005e10ea8648c9fe4265bnd<p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
73ba54c33b4fcad0e13005e10ea8648c9fe4265bnd<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>