diff options
author | Stefan Fritsch <sf@sfritsch.de> | 2014-03-29 21:56:19 +0100 |
---|---|---|
committer | Stefan Fritsch <sf@sfritsch.de> | 2014-03-29 21:56:45 +0100 |
commit | 2a463b3cd73c32ee9dcd508248d0194923f435f4 (patch) | |
tree | 2ff478255a77a55031056790918b6f983bb7b20a /docs/manual/vhosts/examples.html.en | |
parent | 86d5cc79d9d6750da8771fdb0c9ab22c19b8ad45 (diff) | |
download | apache2-upstream/2.4.9.tar.gz |
Imported Upstream version 2.4.9upstream/2.4.9
Diffstat (limited to 'docs/manual/vhosts/examples.html.en')
-rw-r--r-- | docs/manual/vhosts/examples.html.en | 89 |
1 files changed, 32 insertions, 57 deletions
diff --git a/docs/manual/vhosts/examples.html.en b/docs/manual/vhosts/examples.html.en index 8e3c2e82..6c2256b8 100644 --- a/docs/manual/vhosts/examples.html.en +++ b/docs/manual/vhosts/examples.html.en @@ -9,7 +9,7 @@ <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" /> -<script src="../style/scripts/prettify.js" type="text/javascript"> +<script src="../style/scripts/prettify.min.js" type="text/javascript"> </script> <link href="../images/favicon.ico" rel="shortcut icon" /></head> @@ -78,8 +78,7 @@ <code>hosts</code> entries.</p> </div> - <pre class="prettyprint lang-config"> -# Ensure that Apache listens on port 80 + <pre class="prettyprint lang-config"># Ensure that Apache listens on port 80 Listen 80 <VirtualHost *:80> DocumentRoot /www/example1 @@ -93,8 +92,7 @@ Listen 80 ServerName www.example.org # Other directives here -</VirtualHost> - </pre> +</VirtualHost></pre> <p>The asterisks match all addresses, so the main server serves no @@ -142,8 +140,7 @@ Listen 80 will serve the "main" server, <code>server.example.com</code> and on the other (<code>172.20.30.50</code>), we will serve two or more virtual hosts.</p> - <pre class="prettyprint lang-config"> -Listen 80 + <pre class="prettyprint lang-config">Listen 80 # This is the "main" server running on 172.20.30.40 ServerName server.example.com @@ -161,8 +158,7 @@ DocumentRoot /www/mainserver ServerName www.example.org # Other directives here ... -</VirtualHost> - </pre> +</VirtualHost></pre> <p>Any request to an address other than <code>172.20.30.50</code> will be @@ -188,13 +184,11 @@ DocumentRoot /www/mainserver with the same content, with just one <code>VirtualHost</code> section.</p> - <pre class="prettyprint lang-config"> -<VirtualHost 192.168.1.1 172.20.30.40> + <pre class="prettyprint lang-config"><VirtualHost 192.168.1.1 172.20.30.40> DocumentRoot /www/server1 ServerName server.example.com ServerAlias server -</VirtualHost> - </pre> +</VirtualHost></pre> <p>Now requests from both networks will be served from the same @@ -221,8 +215,7 @@ DocumentRoot /www/mainserver takes place after the best matching IP address and port combination is determined.</p> - <pre class="prettyprint lang-config"> -Listen 80 + <pre class="prettyprint lang-config">Listen 80 Listen 8080 <VirtualHost 172.20.30.40:80> @@ -243,8 +236,7 @@ Listen 8080 <VirtualHost 172.20.30.40:8080> ServerName www.example.org DocumentRoot /www/otherdomain-8080 -</VirtualHost> - </pre> +</VirtualHost></pre> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> @@ -256,8 +248,7 @@ Listen 8080 <code>www.example.com</code> and <code>www.example.org</code> respectively.</p> - <pre class="prettyprint lang-config"> -Listen 80 + <pre class="prettyprint lang-config">Listen 80 <VirtualHost 172.20.30.40> DocumentRoot /www/example1 @@ -267,8 +258,7 @@ Listen 80 <VirtualHost 172.20.30.50> DocumentRoot /www/example2 ServerName www.example.org -</VirtualHost> - </pre> +</VirtualHost></pre> <p>Requests for any address not specified in one of the @@ -287,8 +277,7 @@ Listen 80 respectively. In each case, we want to run hosts on ports 80 and 8080.</p> - <pre class="prettyprint lang-config"> -Listen 172.20.30.40:80 + <pre class="prettyprint lang-config">Listen 172.20.30.40:80 Listen 172.20.30.40:8080 Listen 172.20.30.50:80 Listen 172.20.30.50:8080 @@ -311,8 +300,7 @@ Listen 172.20.30.50:8080 <VirtualHost 172.20.30.50:8080> DocumentRoot /www/example2-8080 ServerName www.example.org -</VirtualHost> - </pre> +</VirtualHost></pre> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> @@ -323,8 +311,7 @@ Listen 172.20.30.50:8080 <p>Any address mentioned in the argument to a virtualhost that never appears in another virtual host is a strictly IP-based virtual host.</p> - <pre class="prettyprint lang-config"> -Listen 80 + <pre class="prettyprint lang-config">Listen 80 <VirtualHost 172.20.30.40> DocumentRoot /www/example1 ServerName www.example.com @@ -349,8 +336,7 @@ Listen 80 <VirtualHost 172.20.30.60> DocumentRoot /www/example5 ServerName www.example.gov -</VirtualHost> - </pre> +</VirtualHost></pre> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> @@ -361,18 +347,17 @@ Listen 80 <p>The following example allows a front-end machine to proxy a virtual host through to a server running on another machine. In the example, a virtual host of the same name is configured on a machine - at <code>192.168.111.2</code>. The <code class="directive"><a href="../mod/mod_proxy.html#proxypreservehost on">ProxyPreserveHost On</a></code> directive is - used so that the desired hostname is passed through, in case we are - proxying multiple hostnames to a single machine.</p> + at <code>192.168.111.2</code>. The <code class="directive"><a href="../mod/mod_proxy.html#proxypreservehost">ProxyPreserveHost + On</a></code> directive is used so that the desired hostname is + passed through, in case we are proxying multiple hostnames to a + single machine.</p> - <pre class="prettyprint lang-config"> -<VirtualHost *:*> + <pre class="prettyprint lang-config"><VirtualHost *:*> ProxyPreserveHost On ProxyPass / http://192.168.111.2/ ProxyPassReverse / http://192.168.111.2/ ServerName hostname.example.com -</VirtualHost> - </pre> +</VirtualHost></pre> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> @@ -387,11 +372,9 @@ Listen 80 port, <em>i.e.</em>, an address/port combination that is not used for any other virtual host.</p> - <pre class="prettyprint lang-config"> -<VirtualHost _default_:*> + <pre class="prettyprint lang-config"><VirtualHost _default_:*> DocumentRoot /www/default -</VirtualHost> - </pre> +</VirtualHost></pre> <p>Using such a default vhost with a wildcard port effectively prevents @@ -414,8 +397,7 @@ Listen 80 <p>Same as setup 1, but the server listens on several ports and we want to use a second <code>_default_</code> vhost for port 80.</p> - <pre class="prettyprint lang-config"> -<VirtualHost _default_:80> + <pre class="prettyprint lang-config"><VirtualHost _default_:80> DocumentRoot /www/default80 # ... </VirtualHost> @@ -423,8 +405,7 @@ Listen 80 <VirtualHost _default_:*> DocumentRoot /www/default # ... -</VirtualHost> - </pre> +</VirtualHost></pre> <p>The default vhost for port 80 (which <em>must</em> appear before any @@ -439,12 +420,10 @@ Listen 80 <p>We want to have a default vhost for port 80, but no other default vhosts.</p> - <pre class="prettyprint lang-config"> -<VirtualHost _default_:80> + <pre class="prettyprint lang-config"><VirtualHost _default_:80> DocumentRoot /www/default ... -</VirtualHost> - </pre> +</VirtualHost></pre> <p>A request to an unspecified address on port 80 is served from the @@ -472,8 +451,7 @@ DocumentRoot /www/default (<code>172.20.30.50</code>) to the <code>VirtualHost</code> directive.</p> - <pre class="prettyprint lang-config"> -Listen 80 + <pre class="prettyprint lang-config">Listen 80 ServerName www.example.com DocumentRoot /www/example1 @@ -488,8 +466,7 @@ DocumentRoot /www/example1 ServerName www.example.net ServerAlias *.example.net # ... -</VirtualHost> - </pre> +</VirtualHost></pre> <p>The vhost can now be accessed through the new address (as an @@ -510,8 +487,7 @@ DocumentRoot /www/example1 containing links with an URL prefix to the name-based virtual hosts.</p> - <pre class="prettyprint lang-config"> -<VirtualHost 172.20.30.40> + <pre class="prettyprint lang-config"><VirtualHost 172.20.30.40> # primary vhost DocumentRoot /www/subdomain RewriteEngine On @@ -535,8 +511,7 @@ DocumentRoot /www/subdomain/sub1 RewriteEngine On RewriteRule ^(/sub2/.*) /www/subdomain$1 # ... -</VirtualHost> - </pre> +</VirtualHost></pre> <p>Due to the <code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code> @@ -582,7 +557,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/vhosts/examples.html } })(window, document); //--><!]]></script></div><div id="footer"> -<p class="apache">Copyright 2013 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="apache">Copyright 2014 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="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- if (typeof(prettyPrint) !== 'undefined') { prettyPrint(); |