1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5
This file is generated from xml source: DO NOT EDIT
6
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8
<title>Apache IP-based Virtual Host Support - Apache HTTP Server</title>
9
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
13
<body id="manual-page"><div id="page-header">
14
<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>
15
<p class="apache">Apache HTTP Server Version 2.2</p>
16
<img alt="" src="../images/feather.gif" /></div>
17
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
19
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Virtual Hosts</a></div><div id="page-content"><div id="preamble"><h1>Apache IP-based Virtual Host Support</h1>
21
<p><span>Available Languages: </span><a href="../en/vhosts/ip-based.html" title="English"> en </a> |
22
<a href="../fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
23
<a href="../ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
24
<a href="../ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
27
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#requirements">System requirements</a></li>
28
<li><img alt="" src="../images/down.gif" /> <a href="#howto">How to set up Apache</a></li>
29
<li><img alt="" src="../images/down.gif" /> <a href="#multiple">Setting up multiple daemons</a></li>
30
<li><img alt="" src="../images/down.gif" /> <a href="#single">Setting up a single daemon
31
with virtual hosts</a></li>
32
</ul><h3>See also</h3><ul class="seealso"><li>
33
<a href="name-based.html">Name-based Virtual Hosts Support</a>
35
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
37
<h2><a name="requirements" id="requirements">System requirements</a></h2>
39
<p>As the term <cite>IP-based</cite> indicates, the server
40
<strong>must have a different IP address for each IP-based
41
virtual host</strong>. This can be achieved by the machine
42
having several physical network connections, or by use of
43
virtual interfaces which are supported by most modern operating
44
systems (see system documentation for details, these are
45
frequently called "ip aliases", and the "ifconfig" command is
46
most commonly used to set them up).</p>
48
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
50
<h2><a name="howto" id="howto">How to set up Apache</a></h2>
52
<p>There are two ways of configuring apache to support multiple
53
hosts. Either by running a separate <code class="program"><a href="../programs/httpd.html">httpd</a></code> daemon for
54
each hostname, or by running a single daemon which supports all the
57
<p>Use multiple daemons when:</p>
60
<li>There are security partitioning issues, such as company1
61
does not want anyone at company2 to be able to read their
62
data except via the web. In this case you would need two
63
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>
65
<li>You can afford the memory and file descriptor
66
requirements of listening to every IP alias on the
67
machine. It's only possible to <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
68
address, or to specific addresses. So if you have a need to
69
listen to a specific address for whatever reason, then you
70
will need to listen to all specific addresses. (Although one
71
<code class="program"><a href="../programs/httpd.html">httpd</a></code> could listen to N-1 of the addresses, and another could
72
listen to the remaining address.)</li>
75
<p>Use a single daemon when:</p>
78
<li>Sharing of the httpd configuration between virtual hosts
81
<li>The machine services a large number of requests, and so
82
the performance loss in running separate daemons may be
86
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
88
<h2><a name="multiple" id="multiple">Setting up multiple daemons</a></h2>
90
<p>Create a separate <code class="program"><a href="../programs/httpd.html">httpd</a></code> installation for each
91
virtual host. For each installation, use the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive in the
92
configuration file to select which IP address (or virtual host)
93
that daemon services. e.g.</p>
95
<div class="example"><p><code>
96
Listen www.smallco.com:80
99
<p>It is recommended that you use an IP address instead of a
100
hostname (see <a href="../dns-caveats.html">DNS caveats</a>).</p>
102
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
103
<div class="section">
104
<h2><a name="single" id="single">Setting up a single daemon
105
with virtual hosts</a></h2>
107
<p>For this case, a single <code class="program"><a href="../programs/httpd.html">httpd</a></code> will service
108
requests for the main server and all the virtual hosts. The <code class="directive"><a href="../mod/core.html#virtualhost">VirtualHost</a></code> directive
109
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>
110
or <code class="directive"><a href="../mod/mod_log_config.html#customlog">CustomLog</a></code>
111
configuration directives to different values for each virtual
114
<div class="example"><p><code>
115
<VirtualHost www.smallco.com><br />
116
ServerAdmin webmaster@mail.smallco.com<br />
117
DocumentRoot /groups/smallco/www<br />
118
ServerName www.smallco.com<br />
119
ErrorLog /groups/smallco/logs/error_log<br />
120
TransferLog /groups/smallco/logs/access_log<br />
121
</VirtualHost><br />
123
<VirtualHost www.baygroup.org><br />
124
ServerAdmin webmaster@mail.baygroup.org<br />
125
DocumentRoot /groups/baygroup/www<br />
126
ServerName www.baygroup.org<br />
127
ErrorLog /groups/baygroup/logs/error_log<br />
128
TransferLog /groups/baygroup/logs/access_log<br />
132
<p>It is recommended that you use an IP address instead of a
133
hostname (see <a href="../dns-caveats.html">DNS caveats</a>).</p>
135
<p>Almost <strong>any</strong> configuration directive can be
136
put in the VirtualHost directive, with the exception of
137
directives that control process creation and a few other
138
directives. To find out if a directive can be used in the
139
VirtualHost directive, check the <a href="../mod/directive-dict.html#Context">Context</a> using the
140
<a href="../mod/directives.html">directive index</a>.</p>
142
<p><code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>
144
VirtualHost directive if the <a href="../suexec.html">suEXEC
145
wrapper</a> is used.</p>
147
<p><em>SECURITY:</em> When specifying where to write log files,
148
be aware of some security risks which are present if anyone
149
other than the user that starts Apache has write access to the
150
directory where they are written. See the <a href="../misc/security_tips.html">security tips</a> document
154
<div class="bottomlang">
155
<p><span>Available Languages: </span><a href="../en/vhosts/ip-based.html" title="English"> en </a> |
156
<a href="../fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
157
<a href="../ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
158
<a href="../ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
159
</div><div id="footer">
160
<p class="apache">Copyright 2006 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>
161
<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>
b'\\ No newline at end of file'