ip-based.html.en revision f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
22a41ae508535e87c3c2270202ae78de6ac4672crbowen XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
22a41ae508535e87c3c2270202ae78de6ac4672crbowen This file is generated from xml source: DO NOT EDIT
22a41ae508535e87c3c2270202ae78de6ac4672crbowen XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<title>Apache IP-based Virtual Host Support - Apache HTTP Server</title>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<link href="/images/favicon.ico" rel="shortcut icon" /></head>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<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>
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz<p class="apache">Apache HTTP Server Version 2.3</p>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
4b5981e276e93df97c34e4da05ca5cf8bbd937dand<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.3</a> > <a href="./">Virtual Hosts</a></div><div id="page-content"><div id="preamble"><h1>Apache IP-based Virtual Host Support</h1>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English"> en </a> |
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<a href="/tr/vhosts/ip-based.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#explanation">What is IP-based virtual hosting</a></li>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<li><img alt="" src="/images/down.gif" /> <a href="#requirements">System requirements</a></li>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<li><img alt="" src="/images/down.gif" /> <a href="#howto">How to set up Apache</a></li>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<li><img alt="" src="/images/down.gif" /> <a href="#multiple">Setting up multiple daemons</a></li>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<li><img alt="" src="/images/down.gif" /> <a href="#single">Setting up a single daemon
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<a href="name-based.html">Name-based Virtual Hosts Support</a>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<h2><a name="explanation" id="explanation">What is IP-based virtual hosting</a></h2>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<p>IP-based virtual hosting is a method to apply different directives
22a41ae508535e87c3c2270202ae78de6ac4672crbowenbased on the IP address and port a request is received on. Most commonly,
22a41ae508535e87c3c2270202ae78de6ac4672crbowenthis is used to serve different websites on different ports or interfaces.</p>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<p>In many cases, <a href="name-based.html">name-based
22a41ae508535e87c3c2270202ae78de6ac4672crbowenvirtual hosts</a> are more convenient, because they allow
22a41ae508535e87c3c2270202ae78de6ac4672crbowenSee <a href="name-based.html#namevip">Name-based vs. IP-based
22a41ae508535e87c3c2270202ae78de6ac4672crbowen</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<h2><a name="requirements" id="requirements">System requirements</a></h2>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <p>As the term <cite>IP-based</cite> indicates, the server
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <strong>must have a different IP address/port combination for each IP-based
22a41ae508535e87c3c2270202ae78de6ac4672crbowen virtual host</strong>. This can be achieved by the machine
22a41ae508535e87c3c2270202ae78de6ac4672crbowen having several physical network connections, or by use of
22a41ae508535e87c3c2270202ae78de6ac4672crbowen virtual interfaces which are supported by most modern operating
22a41ae508535e87c3c2270202ae78de6ac4672crbowen systems (see system documentation for details, these are
22a41ae508535e87c3c2270202ae78de6ac4672crbowen frequently called "ip aliases", and the "ifconfig" command is
22a41ae508535e87c3c2270202ae78de6ac4672crbowen most commonly used to set them up), and/or using multiple
22a41ae508535e87c3c2270202ae78de6ac4672crbowen port numbers.</p>
1db37411af96e1c17b78ed2b35461187791250cbrbowen <p> In the terminology of Apache HTTP Server, using a single IP address
22a41ae508535e87c3c2270202ae78de6ac4672crbowen but multiple TCP ports, is also IP-based virtual hosting.</p>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen<h2><a name="howto" id="howto">How to set up Apache</a></h2>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <p>There are two ways of configuring apache to support multiple
22a41ae508535e87c3c2270202ae78de6ac4672crbowen hosts. Either by running a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> daemon for
22a41ae508535e87c3c2270202ae78de6ac4672crbowen each hostname, or by running a single daemon which supports all the
4eb5e97c7a147352e1017b0114d2719d5f67cea9rbowen virtual hosts.</p>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <li>There are security partitioning issues, such as company1
22a41ae508535e87c3c2270202ae78de6ac4672crbowen does not want anyone at company2 to be able to read their
f3f7fbd152943fb15146b438ec8a4c39c404a2fbrbowen data except via the web. In this case you would need two
f3f7fbd152943fb15146b438ec8a4c39c404a2fbrbowen 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>
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <li>You can afford the memory and file descriptor
ec7f95732d562ee4f5586faea04d12df7fb20180rbowen requirements of listening to every IP alias on the
ec7f95732d562ee4f5586faea04d12df7fb20180rbowen machine. It's only possible to <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> to the "wildcard"
ec7f95732d562ee4f5586faea04d12df7fb20180rbowen address, or to specific addresses. So if you have a need to
22a41ae508535e87c3c2270202ae78de6ac4672crbowen listen to a specific address for whatever reason, then you
22a41ae508535e87c3c2270202ae78de6ac4672crbowen will need to listen to all specific addresses. (Although one
22a41ae508535e87c3c2270202ae78de6ac4672crbowen <code class="program"><a href="/programs/httpd.html">httpd</a></code> could listen to N-1 of the addresses, and another could
22a41ae508535e87c3c2270202ae78de6ac4672crbowen listen to the remaining address.)</li>
<p>Create a separate <code class="program"><a href="/programs/httpd.html">httpd</a></code> installation for each
virtual host. For each installation, use the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directive in the
<p>For this case, a single <code class="program"><a href="/programs/httpd.html">httpd</a></code> 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>
<p><code class="directive"><a href="/mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>
directory where they are written. See the <a href="/misc/security_tips.html">security tips</a> document
<p><span>Available Languages: </span><a href="/en/vhosts/ip-based.html" title="English"> en </a> |
<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
<a href="/ja/vhosts/ip-based.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
<a href="/tr/vhosts/ip-based.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
<p class="apache">Copyright 2011 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>