From: Daniel Gruno <humbedooh@apache.org> Date: Thu, 26 Apr 2012 14:38:55 +0000 (+0000) Subject: syntax updates X-Git-Tag: 2.5.0-alpha~7015 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96a04aeb015abf35c441123578f0a632301f45ed;p=apache syntax updates git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1330878 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/vhosts/examples.xml b/docs/manual/vhosts/examples.xml index 0d96e98454..86f99f07bf 100644 --- a/docs/manual/vhosts/examples.xml +++ b/docs/manual/vhosts/examples.xml @@ -53,33 +53,23 @@ <code>hosts</code> entries.</p> </note> - <example> - <title>Server configuration</title> - - # Ensure that Apache listens on port 80<br /> - Listen 80<br /> - <br /> - <br /> - <VirtualHost *:80><br /> - <indent> - DocumentRoot /www/example1<br /> - ServerName www.example.com<br /> - <br /> - # Other directives here<br /> - <br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost *:80><br /> - <indent> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - <br /> - # Other directives here<br /> - <br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +# Ensure that Apache listens on port 80 +Listen 80 +<VirtualHost *:80> + DocumentRoot /www/example1 + ServerName www.example.com + + # Other directives here +</VirtualHost> + +<VirtualHost *:80> + DocumentRoot /www/example2 + ServerName www.example.org + + # Other directives here +</VirtualHost> + </highlight> <p>The asterisks match all addresses, so the main server serves no requests. Due to the fact that the virtual host with @@ -126,35 +116,27 @@ 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> - <example> - <title>Server configuration</title> - - Listen 80<br /> - <br /> - # This is the "main" server running on 172.20.30.40<br /> - ServerName server.example.com<br /> - DocumentRoot /www/mainserver<br /> - <br /> - <VirtualHost 172.20.30.50><br /> - <indent> - DocumentRoot /www/example1<br /> - ServerName www.example.com<br /> - <br /> - # Other directives here ...<br /> - <br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50><br /> - <indent> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - <br /> - # Other directives here ...<br /> - <br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +Listen 80 + +# This is the "main" server running on 172.20.30.40 +ServerName server.example.com +DocumentRoot /www/mainserver + +<VirtualHost 172.20.30.50> + DocumentRoot /www/example1 + ServerName www.example.com + + # Other directives here ... +</VirtualHost> + +<VirtualHost 172.20.30.50> + DocumentRoot /www/example2 + ServerName www.example.org + + # Other directives here ... +</VirtualHost> + </highlight> <p>Any request to an address other than <code>172.20.30.50</code> will be served from the main server. A request to <code>172.20.30.50</code> with an @@ -179,18 +161,13 @@ with the same content, with just one <code>VirtualHost</code> section.</p> - <example> - <title>Server configuration</title> - - <br /> - <VirtualHost 192.168.1.1 172.20.30.40><br /> - <indent> - DocumentRoot /www/server1<br /> - ServerName server.example.com<br /> - ServerAlias server<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost 192.168.1.1 172.20.30.40> + DocumentRoot /www/server1 + ServerName server.example.com + ServerAlias server +</VirtualHost> + </highlight> <p>Now requests from both networks will be served from the same <code>VirtualHost</code>.</p> @@ -216,40 +193,30 @@ takes place after the best matching IP address and port combination is determined.</p> - <example> - <title>Server configuration</title> - - Listen 80<br /> - Listen 8080<br /> - <br /> - <VirtualHost 172.20.30.40:80><br /> - <indent> - ServerName www.example.com<br /> - DocumentRoot /www/domain-80<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <indent> - ServerName www.example.com<br /> - DocumentRoot /www/domain-8080<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:80><br /> - <indent> - ServerName www.example.org<br /> - DocumentRoot /www/otherdomain-80<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <indent> - ServerName www.example.org<br /> - DocumentRoot /www/otherdomain-8080<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +Listen 80 +Listen 8080 + +<VirtualHost 172.20.30.40:80> + ServerName www.example.com + DocumentRoot /www/domain-80 +</VirtualHost> + +<VirtualHost 172.20.30.40:8080> + ServerName www.example.com + DocumentRoot /www/domain-8080 +</VirtualHost> + +<VirtualHost 172.20.30.40:80> + ServerName www.example.org + DocumentRoot /www/otherdomain-80 +</VirtualHost> + +<VirtualHost 172.20.30.40:8080> + ServerName www.example.org + DocumentRoot /www/otherdomain-8080 +</VirtualHost> + </highlight> </section> @@ -260,25 +227,19 @@ <code>www.example.com</code> and <code>www.example.org</code> respectively.</p> - <example> - <title>Server configuration</title> - - Listen 80<br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/example1<br /> - ServerName www.example.com<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50><br /> - <indent> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +Listen 80 + +<VirtualHost 172.20.30.40> + DocumentRoot /www/example1 + ServerName www.example.com +</VirtualHost> + +<VirtualHost 172.20.30.50> + DocumentRoot /www/example2 + ServerName www.example.org +</VirtualHost> + </highlight> <p>Requests for any address not specified in one of the <code><VirtualHost></code> directives (such as @@ -296,42 +257,32 @@ respectively. In each case, we want to run hosts on ports 80 and 8080.</p> - <example> - <title>Server configuration</title> - - Listen 172.20.30.40:80<br /> - Listen 172.20.30.40:8080<br /> - Listen 172.20.30.50:80<br /> - Listen 172.20.30.50:8080<br /> - <br /> - <VirtualHost 172.20.30.40:80><br /> - <indent> - DocumentRoot /www/example1-80<br /> - ServerName www.example.com<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <indent> - DocumentRoot /www/example1-8080<br /> - ServerName www.example.com<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50:80><br /> - <indent> - DocumentRoot /www/example2-80<br /> - ServerName www.example.org<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50:8080><br /> - <indent> - DocumentRoot /www/example2-8080<br /> - ServerName www.example.org<br /> - </indent> - </VirtualHost> - </example> + <highlight language="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 + +<VirtualHost 172.20.30.40:80> + DocumentRoot /www/example1-80 + ServerName www.example.com +</VirtualHost> + +<VirtualHost 172.20.30.40:8080> + DocumentRoot /www/example1-8080 + ServerName www.example.com +</VirtualHost> + +<VirtualHost 172.20.30.50:80> + DocumentRoot /www/example2-80 + ServerName www.example.org +</VirtualHost> + +<VirtualHost 172.20.30.50:8080> + DocumentRoot /www/example2-8080 + ServerName www.example.org +</VirtualHost> + </highlight> </section> @@ -341,46 +292,34 @@ <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> - <example> - <title>Server configuration</title> - - Listen 80<br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/example1<br /> - ServerName www.example.com<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/example3<br /> - ServerName www.example.net<br /> - </indent> - </VirtualHost><br /> - <br /> - # IP-based<br /> - <VirtualHost 172.20.30.50><br /> - <indent> - DocumentRoot /www/example4<br /> - ServerName www.example.edu<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.60><br /> - <indent> - DocumentRoot /www/example5<br /> - ServerName www.example.gov<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +Listen 80 +<VirtualHost 172.20.30.40> + DocumentRoot /www/example1 + ServerName www.example.com +</VirtualHost> + +<VirtualHost 172.20.30.40> + DocumentRoot /www/example2 + ServerName www.example.org +</VirtualHost> + +<VirtualHost 172.20.30.40> + DocumentRoot /www/example3 + ServerName www.example.net +</VirtualHost> + +# IP-based +<VirtualHost 172.20.30.50> + DocumentRoot /www/example4 + ServerName www.example.edu +</VirtualHost> + +<VirtualHost 172.20.30.60> + DocumentRoot /www/example5 + ServerName www.example.gov +</VirtualHost> + </highlight> </section> @@ -395,14 +334,14 @@ used so that the desired hostname is passed through, in case we are proxying multiple hostnames to a single machine.</p> - <example> - <VirtualHost *:*><br /> - ProxyPreserveHost On<br /> - ProxyPass / http://192.168.111.2/<br /> - ProxyPassReverse / http://192.168.111.2/<br /> - ServerName hostname.example.com<br /> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost *:*> + ProxyPreserveHost On + ProxyPass / http://192.168.111.2/ + ProxyPassReverse / http://192.168.111.2/ + ServerName hostname.example.com +</VirtualHost> + </highlight> </section> @@ -416,15 +355,11 @@ port, <em>i.e.</em>, an address/port combination that is not used for any other virtual host.</p> - <example> - <title>Server configuration</title> - - <VirtualHost _default_:*><br /> - <indent> - DocumentRoot /www/default<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost _default_:*> + DocumentRoot /www/default +</VirtualHost> + </highlight> <p>Using such a default vhost with a wildcard port effectively prevents any request going to the main server.</p> @@ -446,23 +381,17 @@ <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> - <example> - <title>Server configuration</title> - - <VirtualHost _default_:80><br /> - <indent> - DocumentRoot /www/default80<br /> - # ...<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost _default_:*><br /> - <indent> - DocumentRoot /www/default<br /> - # ...<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost _default_:80> + DocumentRoot /www/default80 + # ... +</VirtualHost> + +<VirtualHost _default_:*> + DocumentRoot /www/default + # ... +</VirtualHost> + </highlight> <p>The default vhost for port 80 (which <em>must</em> appear before any default vhost with a wildcard port) catches all requests that were sent @@ -476,14 +405,12 @@ <p>We want to have a default vhost for port 80, but no other default vhosts.</p> - <example> - <title>Server configuration</title> - - <VirtualHost _default_:80><br /> - DocumentRoot /www/default<br /> - ...<br /> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost _default_:80> +DocumentRoot /www/default +... +</VirtualHost> + </highlight> <p>A request to an unspecified address on port 80 is served from the default vhost. Any other request to an unspecified address and port is @@ -511,30 +438,24 @@ (<code>172.20.30.50</code>) to the <code>VirtualHost</code> directive.</p> - <example> - <title>Server configuration</title> - - Listen 80<br /> - ServerName www.example.com<br /> - DocumentRoot /www/example1<br /> - <br /> - <VirtualHost 172.20.30.40 172.20.30.50><br /> - <indent> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - # ...<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/example3<br /> - ServerName www.example.net<br /> - ServerAlias *.example.net<br /> - # ...<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +Listen 80 +ServerName www.example.com +DocumentRoot /www/example1 + +<VirtualHost 172.20.30.40 172.20.30.50> + DocumentRoot /www/example2 + ServerName www.example.org + # ... +</VirtualHost> + +<VirtualHost 172.20.30.40> + DocumentRoot /www/example3 + ServerName www.example.net + ServerAlias *.example.net + # ... +</VirtualHost> + </highlight> <p>The vhost can now be accessed through the new address (as an IP-based vhost) and through the old address (as a name-based @@ -554,41 +475,33 @@ containing links with an URL prefix to the name-based virtual hosts.</p> - <example> - <title>Server configuration</title> - - <VirtualHost 172.20.30.40><br /> - <indent> - # primary vhost<br /> - DocumentRoot /www/subdomain<br /> - RewriteEngine On<br /> - RewriteRule . /www/subdomain/index.html<br /> - # ...<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - DocumentRoot /www/subdomain/sub1<br /> - <indent> - ServerName www.sub1.domain.tld<br /> - ServerPath /sub1/<br /> - RewriteEngine On<br /> - RewriteRule ^(/sub1/.*) /www/subdomain$1<br /> - # ...<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <indent> - DocumentRoot /www/subdomain/sub2<br /> - ServerName www.sub2.domain.tld<br /> - ServerPath /sub2/<br /> - RewriteEngine On<br /> - RewriteRule ^(/sub2/.*) /www/subdomain$1<br /> - # ...<br /> - </indent> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost 172.20.30.40> + # primary vhost + DocumentRoot /www/subdomain + RewriteEngine On + RewriteRule . /www/subdomain/index.html + # ... +</VirtualHost> + +<VirtualHost 172.20.30.40> +DocumentRoot /www/subdomain/sub1 + ServerName www.sub1.domain.tld + ServerPath /sub1/ + RewriteEngine On + RewriteRule ^(/sub1/.*) /www/subdomain$1 + # ... +</VirtualHost> + +<VirtualHost 172.20.30.40> + DocumentRoot /www/subdomain/sub2 + ServerName www.sub2.domain.tld + ServerPath /sub2/ + RewriteEngine On + RewriteRule ^(/sub2/.*) /www/subdomain$1 + # ... +</VirtualHost> + </highlight> <p>Due to the <directive module="core">ServerPath</directive> directive a request to the URL diff --git a/docs/manual/vhosts/fd-limits.xml b/docs/manual/vhosts/fd-limits.xml index 2c08d07956..cd9802eb6e 100644 --- a/docs/manual/vhosts/fd-limits.xml +++ b/docs/manual/vhosts/fd-limits.xml @@ -91,10 +91,10 @@ LogFormat</directive> directive, and the <code>%v</code> variable. Add this to the beginning of your log format string:</p> -<example> -LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost<br /> +<highlight language="config"> +LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost CustomLog logs/multiple_vhost_log vhost -</example> +</highlight> <p>This will create a log file in the common log format, but with the canonical virtual host (whatever appears in the diff --git a/docs/manual/vhosts/ip-based.xml b/docs/manual/vhosts/ip-based.xml index 37cb7727f4..69c323b3bb 100644 --- a/docs/manual/vhosts/ip-based.xml +++ b/docs/manual/vhosts/ip-based.xml @@ -108,9 +108,9 @@ Virtual Hosts</a> to help you decide. </p> configuration file to select which IP address (or virtual host) that daemon services. e.g.</p> - <example> + <highlight language="config"> Listen 192.0.2.100:80 - </example> + </highlight> <p>It is recommended that you use an IP address instead of a hostname (see <a href="../dns-caveats.html">DNS caveats</a>).</p> @@ -133,23 +133,23 @@ Virtual Hosts</a> to help you decide. </p> configuration directives to different values for each virtual host. e.g.</p> - <example> - <VirtualHost 172.20.30.40:80><br /> - ServerAdmin webmaster@www1.example.com<br /> - DocumentRoot /www/vhosts/www1<br /> - ServerName www1.example.com<br /> - ErrorLog /www/logs/www1/error_log<br /> - CustomLog /www/logs/www1/access_log combined<br /> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50:80><br /> - ServerAdmin webmaster@www2.example.org<br /> - DocumentRoot /www/vhosts/www2<br /> - ServerName www2.example.org<br /> - ErrorLog /www/logs/www2/error_log<br /> - CustomLog /www/logs/www2/access_log combined<br /> - </VirtualHost> - </example> + <highlight language="config"> +<VirtualHost 172.20.30.40:80> + ServerAdmin webmaster@www1.example.com + DocumentRoot /www/vhosts/www1 + ServerName www1.example.com + ErrorLog /www/logs/www1/error_log + CustomLog /www/logs/www1/access_log combined +</VirtualHost> + +<VirtualHost 172.20.30.50:80> + ServerAdmin webmaster@www2.example.org + DocumentRoot /www/vhosts/www2 + ServerName www2.example.org + ErrorLog /www/logs/www2/error_log + CustomLog /www/logs/www2/access_log combined +</VirtualHost> + </highlight> <p>It is recommended that you use an IP address instead of a hostname in the <VirtualHost> directive diff --git a/docs/manual/vhosts/mass.xml b/docs/manual/vhosts/mass.xml index 3df4e2531c..3a5afcb436 100644 --- a/docs/manual/vhosts/mass.xml +++ b/docs/manual/vhosts/mass.xml @@ -41,8 +41,7 @@ <code><VirtualHost></code> sections that are substantially the same, for example:</p> -<example> -<pre> +<highlight language="config"> <VirtualHost 111.22.33.44> ServerName customer-1.example.com DocumentRoot /www/hosts/customer-1.example.com/docs @@ -60,8 +59,7 @@ DocumentRoot /www/hosts/customer-N.example.com/docs ScriptAlias /cgi-bin/ /www/hosts/customer-N.example.com/cgi-bin </VirtualHost> -</pre> -</example> +</highlight> <p>We wish to replace these multiple <code><VirtualHost></code> blocks with a mechanism @@ -149,19 +147,19 @@ mod_vhost_alias</title> href="#motivation">Motivation</a> section above using <module>mod_vhost_alias</module>.</p> -<example> -# get the server name from the Host: header<br /> -UseCanonicalName Off<br /> -<br /> -# this log format can be split per-virtual-host based on the first field<br /> -# using the split-logfile utility.<br /> -LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br /> -CustomLog logs/access_log vcommon<br /> -<br /> -# include the server name in the filenames used to satisfy requests<br /> -VirtualDocumentRoot /www/hosts/%0/docs<br /> +<highlight language="config"> +# get the server name from the Host: header +UseCanonicalName Off + +# this log format can be split per-virtual-host based on the first field +# using the split-logfile utility. +LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon +CustomLog logs/access_log vcommon + +# include the server name in the filenames used to satisfy requests +VirtualDocumentRoot /www/hosts/%0/docs VirtualScriptAlias /www/hosts/%0/cgi-bin -</example> +</highlight> <p>This configuration can be changed into an IP-based virtual hosting solution by just turning <code>UseCanonicalName @@ -186,18 +184,18 @@ examples.</p> <code>/home/user/www</code>. It uses a single <code>cgi-bin</code> directory instead of one per virtual host.</p> -<example> -UseCanonicalName Off<br /> -<br /> -LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br /> -CustomLog logs/access_log vcommon<br /> -<br /> -# include part of the server name in the filenames<br /> -VirtualDocumentRoot /home/%2/www<br /> -<br /> -# single cgi-bin directory<br /> -ScriptAlias /cgi-bin/ /www/std-cgi/<br /> -</example> +<highlight language="config"> +UseCanonicalName Off + +LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon +CustomLog logs/access_log vcommon + +# include part of the server name in the filenames +VirtualDocumentRoot /home/%2/www + +# single cgi-bin directory +ScriptAlias /cgi-bin/ /www/std-cgi/ +</highlight> <p>There are examples of more complicated <code>VirtualDocumentRoot</code> settings in the @@ -217,47 +215,39 @@ ScriptAlias /cgi-bin/ /www/std-cgi/<br /> <code><VirtualHost></code> configuration sections, as shown below.</p> -<example> -UseCanonicalName Off<br /> -<br /> -LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br /> -<br /> -<Directory /www/commercial><br /> -<indent> - Options FollowSymLinks<br /> - AllowOverride All<br /> -</indent> -</Directory><br /> -<br /> -<Directory /www/homepages><br /> -<indent> - Options FollowSymLinks<br /> - AllowOverride None<br /> -</indent> -</Directory><br /> -<br /> -<VirtualHost 111.22.33.44><br /> -<indent> - ServerName www.commercial.example.com<br /> - <br /> - CustomLog logs/access_log.commercial vcommon<br /> - <br /> - VirtualDocumentRoot /www/commercial/%0/docs<br /> - VirtualScriptAlias /www/commercial/%0/cgi-bin<br /> -</indent> -</VirtualHost><br /> -<br /> -<VirtualHost 111.22.33.45><br /> -<indent> - ServerName www.homepages.example.com<br /> - <br /> - CustomLog logs/access_log.homepages vcommon<br /> - <br /> - VirtualDocumentRoot /www/homepages/%0/docs<br /> - ScriptAlias /cgi-bin/ /www/std-cgi/<br /> -</indent> +<highlight language="config"> +UseCanonicalName Off + +LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon + +<Directory /www/commercial> + Options FollowSymLinks + AllowOverride All +</Directory> + +<Directory /www/homepages> + Options FollowSymLinks + AllowOverride None +</Directory> + +<VirtualHost 111.22.33.44> + ServerName www.commercial.example.com + + CustomLog logs/access_log.commercial vcommon + + VirtualDocumentRoot /www/commercial/%0/docs + VirtualScriptAlias /www/commercial/%0/cgi-bin </VirtualHost> -</example> + +<VirtualHost 111.22.33.45> + ServerName www.homepages.example.com + + CustomLog logs/access_log.homepages vcommon + + VirtualDocumentRoot /www/homepages/%0/docs + ScriptAlias /cgi-bin/ /www/std-cgi/ +</VirtualHost> +</highlight> <note> <title>Note</title> @@ -282,18 +272,18 @@ LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br /> negating the need for a DNS lookup. Logging will also have to be adjusted to fit this system.</p> -<example> -# get the server name from the reverse DNS of the IP address<br /> -UseCanonicalName DNS<br /> -<br /> -# include the IP address in the logs so they may be split<br /> -LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon<br /> -CustomLog logs/access_log vcommon<br /> -<br /> -# include the IP address in the filenames<br /> -VirtualDocumentRootIP /www/hosts/%0/docs<br /> -VirtualScriptAliasIP /www/hosts/%0/cgi-bin<br /> -</example> +<highlight language="config"> +# get the server name from the reverse DNS of the IP address +UseCanonicalName DNS + +# include the IP address in the logs so they may be split +LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon +CustomLog logs/access_log vcommon + +# include the IP address in the filenames +VirtualDocumentRootIP /www/hosts/%0/docs +VirtualScriptAliasIP /www/hosts/%0/cgi-bin +</highlight> </section> diff --git a/docs/manual/vhosts/name-based.xml b/docs/manual/vhosts/name-based.xml index 63ae0efab2..2b67a0bc4c 100644 --- a/docs/manual/vhosts/name-based.xml +++ b/docs/manual/vhosts/name-based.xml @@ -127,22 +127,19 @@ <code>other.example.com</code>, which points at the same IP address. Then you simply add the following to <code>httpd.conf</code>:</p> - <example> - <VirtualHost *:80><br /> - <indent> - # This first-listed virtual host is also the default for *:80 - ServerName www.example.com<br /> - ServerAlias example.com <br /> - DocumentRoot /www/domain<br /> - </indent> - </VirtualHost><br /> - <br /> - <VirtualHost *:80><br /> - <indent>ServerName other.example.com<br /> - DocumentRoot /www/otherdomain<br /> - </indent> - </VirtualHost><br /> - </example> + <highlight language="config"> +<VirtualHost *:80> + # This first-listed virtual host is also the default for *:80 + ServerName www.example.com + ServerAlias example.com + DocumentRoot /www/domain +</VirtualHost> + +<VirtualHost *:80> +ServerName other.example.com + DocumentRoot /www/otherdomain +</VirtualHost> + </highlight> <p>You can alternatively specify an explicit IP address in place of the <code>*</code> in <directive type="section" module="core" @@ -159,9 +156,9 @@ the listed names are other names which people can use to see that same web site:</p> - <example> + <highlight language="config"> ServerAlias example.com *.example.com - </example> + </highlight> <p>then requests for all hosts in the <code>example.com</code> domain will be served by the <code>www.example.com</code> virtual host. The wildcard