<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
-<!-- English Revision: 1174747:1334033 (outdated) -->
+<!-- English Revision : 1334033 -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<section id="example">
<title>Un exemple simple</title>
- <example>
- # Cet exemple de configuration est invalide, ne l'utilisez pas comme base
- # de configuration
- <VirtualHost www.example.dom> <br />
- ServerAdmin webgirl@example.dom <br />
- DocumentRoot /www/example <br />
- </VirtualHost>
- </example>
+ <highlight language="config">
+# Ceci est un exemple de mauvaise configuration ; ne l'utilisez pas comme base
+# de configuration
+<VirtualHost www.example.dom>
+ ServerAdmin webgirl@example.dom
+ DocumentRoot /www/example
+</VirtualHost>
+ </highlight>
<p>Pour fonctionner correctement, le serveur a absolument besoin de deux
informations à propos de chaque serveur virtuel : le nom du serveur
<p>Supposons que l'adresse de <code>www.example.dom</code> soit
192.0.2.1, et examinons cet extrait de configuration :</p>
- <example>
- # Cet exemple de configuration est invalide, ne l'utilisez pas comme base
- # de configuration
- <VirtualHost 192.0.2.1> <br />
- ServerAdmin webgirl@example.dom <br />
- DocumentRoot /www/example <br />
- </VirtualHost>
- </example>
+ <highlight language="config">
+# Ceci est un exemple de mauvaise configuration ; ne l'utilisez pas comme base
+# de configuration
+<VirtualHost 192.0.2.1>
+ ServerAdmin webgirl@example.dom
+ DocumentRoot /www/example
+</VirtualHost>
+ </highlight>
<p>Cette fois, httpd doit effectuer une recherche DNS inverse pour
trouver le nom <code>ServerName</code> de ce serveur virtuel. Si
<p>Voici un extrait de configuration qui permet d'éviter ces deux
types de problèmes :</p>
- <example>
- <VirtualHost 192.0.2.1> <br />
- ServerName www.example.dom <br />
- ServerAdmin webgirl@example.dom <br />
- DocumentRoot /www/example <br />
- </VirtualHost>
- </example>
+ <highlight language="config">
+<VirtualHost 192.0.2.1>
+ ServerName www.example.dom
+ ServerAdmin webgirl@example.dom
+ DocumentRoot /www/example
+</VirtualHost>
+ </highlight>
</section>
<section id="denial">
<p>Considérons cet extrait de configuration :</p>
- <example>
- <VirtualHost www.example1.dom><br />
- <indent>
- ServerAdmin webgirl@example1.dom<br />
- DocumentRoot /www/example1<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost www.example2.dom><br />
- <indent>
- ServerAdmin webguy@example2.dom<br />
- DocumentRoot /www/example2<br />
- </indent>
- </VirtualHost>
- </example>
+ <highlight language="config">
+<VirtualHost www.example1.dom>
+ ServerAdmin webgirl@example1.dom
+ DocumentRoot /www/example1
+</VirtualHost>
+<VirtualHost www.example2.dom>
+ ServerAdmin webguy@example2.dom
+ DocumentRoot /www/example2
+</VirtualHost>
+ </highlight>
<p>Supposons que vous ayez assigné 192.0.2.1 à
<code>www.example1.dom</code> et 192.0.2.2 à <code>www.example2.dom</code>. En
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
-<!-- English Revision: 1307311:1334033 (outdated) -->
+<!-- English Revision : 1334033 -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
module="mod_ssl">SSLRequire</directive>).</p>
</section>
-
<section id="examples">
<title>Exemples d'expressions</title>
<p>Les exemples suivants montent comment utiliser les
expressions pour évaluer les requêtes :</p>
<!-- This section should probably be extended with more, useful examples -->
- <example>
- # Comparer le nom d'hôte avec example.com et rediriger vers
- # www.example.com si le nom d'hôte correspond<br />
- <If "%{HTTP_HOST} == 'example.com'"><br />
- <indent>
- Redirect permanent / http://www.example.com<br />
- </indent>
- </If><br /><br />
- # Forcer le type text/plain si un fichier fait l'objet d'une
- # requête dont la chaîne de paramètres contient 'forcetext'<br />
- <If "%{QUERY_STRING} =~ /forcetext/"><br />
- <indent>
- ForceType text/plain<br />
- </indent>
- </If><br /><br />
- # N'autoriser l'accès à ce contenu que pendant les heures de
- # travail<br />
- <Directory "/foo/bar/business"><br />
- <indent>
- Require expr %{TIME_HOUR} >= 9 && %{TIME_HOUR} <= 17 <br />
- </indent>
- </Directory>
- </example>
+ <highlight language="config">
+# Comparer le nom d'hôte avec example.com et rediriger vers
+# www.example.com si le nom d'hôte correspond
+<If "%{HTTP_HOST} == 'example.com'">
+ Redirect permanent / http://www.example.com
+</If>
+
+# Forcer le type text/plain si un fichier fait l'objet d'une
+# requête dont la chaîne de paramètres contient 'forcetext'
+<If "%{QUERY_STRING} =~ /forcetext/">
+ ForceType text/plain
+</If>
+
+# N'autoriser l'accès à ce contenu que pendant les heures de
+# travail
+<Directory "/foo/bar/business">
+ Require expr %{TIME_HOUR} >= 9 && %{TIME_HOUR} <= 17
+</Directory>
+ </highlight>
</section>
<section id="other">
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
-<!-- English Revision: 1174747:1334033 (outdated) -->
+<!-- English Revision : 1334033 -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
</dd>
<dt><a name="apr" id="apr">APR</a></dt>
- <dd>Voir <a href="#apacheportableruntime">"
- Bibliothèques pour la portabilité d'Apache"</a>
+ <dd>Voir "Bibliothèques pour la portabilité d'Apache"
</dd>
<dt><a name="tarball" id="tarball">Archive Tar (Tarball)</a></dt>
<dt><a name="apacheportableruntime"
id="apacheportableruntime">Bibliothèques pour la portabilité d'Apache
- (Apache Portable Runtime, APR)</a></dt>
+ (Apache Portable Runtime)</a> <a
+ name="apr" id="apr">(APR)</a></dt>
<dd>Un jeu de bibliothèques qui fournit la plupart des interfaces de base
entre le serveur et le système d'exploitation. APR est développé
parallèlement au serveur HTTP Apache comme projet indépendant.<br />
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
-<!-- English Revision: 1220529:1333447 (outdated) -->
+<!-- English Revision : 1333447 -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<page href="http://wiki.apache.org/httpd/FAQ">Foire Aux Questions</page>
<page href="sitemap.html">Plan du site</page>
<page href="developer/">Documentation du développeur</page>
+ <page href="http://httpd.apache.org/docs-project/">Aide pour la
+ documentation</page>
<page href="misc/">Autres notes</page>
<page href="http://wiki.apache.org/httpd/">Wiki</page>
</category>
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
-<!-- English Revision: 1300926:1334033 (outdated) -->
+<!-- English Revision : 1334033 -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<p>Pour ce faire, vous devez spécifier le nom du module dans votre
directive <directive>LogLevel</directive> :</p>
- <example>
+ <highlight language="config">
LogLevel info rewrite:trace5
- </example>
+ </highlight>
<p>Dans cet exemple, le niveau de journalisation général est défini
à info, et à <code>trace5</code> pour <module>mod_rewrite</module>.</p>
<p>Voici une configuration typique pour le journal des accès :</p>
- <example>
- LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
- CustomLog logs/access_log common
- </example>
+ <highlight language="config">
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+CustomLog logs/access_log common
+ </highlight>
<p>Ici est définie l'<em>identité</em> <code>common</code> qui est
ensuite associée à une chaîne de format de journalisation particulière.
"Combined Log Format" (Format de journalisation combiné). Il s'utilise
comme suit :</p>
- <example>
- LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
- \"%{User-agent}i\"" combined<br />
- CustomLog log/access_log combined
- </example>
+ <highlight language="config">
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
+CustomLog log/access_log combined
+ </highlight>
<p>Ce format est identique au Common Log Format, avec deux champs
supplémentaires. Chacun de ces deux champs utilise la directive
comment simuler les effets des directives <code>ReferLog</code> et
<code>AgentLog</code>.</p>
- <example>
- LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
- CustomLog logs/access_log common<br />
- CustomLog logs/referer_log "%{Referer}i -> %U"<br />
- CustomLog logs/agent_log "%{User-agent}i"
- </example>
+ <highlight language="config">
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+CustomLog logs/access_log common
+CustomLog logs/referer_log "%{Referer}i -> %U"
+CustomLog logs/agent_log "%{User-agent}i"
+ </highlight>
<p>Cet exemple montre aussi qu'il n'est pas obligatoire d'associer
une chaîne de format à un alias au moyen de la directive
la variable d'environnement est définie.
Quelques exemples :</p>
- <example>
- # Marque les requêtes en provenance de l'interface loop-back<br />
- SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog<br />
- # Marque les requêtes pour le fichier robots.txt<br />
- SetEnvIf Request_URI "^/robots\.txt$" dontlog<br />
- # Journalise toutes les autres requêtes<br />
- CustomLog logs/access_log common env=!dontlog
- </example>
+ <highlight language="config">
+# Marque les requêtes en provenance de l'interface loop-back
+SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
+# Marque les requêtes pour le fichier robots.txt
+SetEnvIf Request_URI "^/robots\.txt$" dontlog
+# Journalise toutes les autres requêtes
+CustomLog logs/access_log common env=!dontlog
+ </highlight>
<p>Autre exemple, imaginons l'enregistrement des requêtes en provenance
d'utilisateurs de langue anglaise dans un journal, et celles des autres
utilisateurs dans un autre journal.</p>
- <example>
+ <highlight language="config">
SetEnvIf Accept-Language "en" english<br />
CustomLog logs/english_log common env=english<br />
CustomLog logs/non_english_log common env=!english
- </example>
+ </highlight>
<p>Dans le contexte d'une mise en cache, il peut être
intéressant de connaître l'efficacité du cache. Pour y parvenir,
on pourrait utiliser cette méthode simple :</p>
- <example>
- SetEnv CACHE_MISS 1<br />
- LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache<br />
- CustomLog logs/access_log common-cache
- </example>
+ <highlight language="config">
+SetEnv CACHE_MISS 1
+LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache
+CustomLog logs/access_log common-cache
+ </highlight>
<p><module>mod_cache</module> va s'exécuter avant
<module>mod_env</module>, et si son action est couronnée de
valeurs de journalisation conditionnelles basées sur le code de la
réponse HTTP :</p>
- <example>
- LogFormat "%400,501{User-agent}i" browserlog<br />
- LogFormat "%!200,304,302{Referer}i" refererlog
- </example>
+ <highlight language="config">
+LogFormat "%400,501{User-agent}i" browserlog
+LogFormat "%!200,304,302{Referer}i" refererlog
+ </highlight>
<p>Dans le premier exemple, le <code>User-agent</code> sera
enregistré si le code d'état HTTP est 400 ou 501. Dans le cas
appelé <program>rotatelogs</program>. Par exemple, pour une rotation des
journaux toutes les 24 heures, ajoutez ces lignes :</p>
- <example>
- CustomLog "|/usr/local/apache/bin/rotatelogs
- /var/log/access_log 86400" common
- </example>
+ <highlight language="config">
+ CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
+ </highlight>
<p>Notez que l'ensemble de la commande qui sera appelée par le tube de
communication a été placée entre guillemets. Bien que cet exemple
au lieu de "<code>|</code>" (en général avec <code>/bin/sh -c</code>)
:</p>
- <example>
- # Invocation de "rotatelogs" en utilisant un shell<br />
- CustomLog "|$/usr/local/apache/bin/rotatelogs
- /var/log/access_log 86400" common
- </example>
+ <highlight language="config">
+# Invocation de "rotatelogs" en utilisant un shell
+CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
+ </highlight>
+
<p>Il s'agissait du comportement par défaut sous Apache 2.2. Selon
les spécificités du shell, ceci peut générer un processus shell
journal, puis de séparer ultérieurement le journal en plusieurs journaux
individuels. Considérons par exemple les directives suivantes :</p>
- <example>
- LogFormat "%v %l %u %t \"%r\" %>s %b"
- comonvhost<br />
- CustomLog logs/access_log comonvhost
- </example>
+ <highlight language="config">
+LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
+CustomLog logs/access_log comonvhost
+ </highlight>
<p>Le champ <code>%v</code> sert à enregistrer le nom de l'hôte virtuel qui
traite la requête. Un programme tel que <a
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1307835:1334022 (outdated) -->
+<!-- English Revision: 1334022 -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1132802:1334000 (outdated) -->
+<!-- English Revision: 1334000 -->
<!-- French translation by Vincent Deffontaines, Alain B., review by -->
<!-- updated by Lucien Gentis -->
que sur la machine possédant ces entrées.</p>
</note>
- <example>
- <title>Configuration du serveur</title>
-
- # Apache doit écouter sur le port 80<br />
- Listen 80<br />
- <br />
- <br />
- <VirtualHost *:80><br />
- <indent>
- DocumentRoot /www/example.com<br />
- ServerName www.example1.com<br />
- <br />
- # Autres directives ici<br />
- <br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost *:80><br />
- <indent>
- DocumentRoot /www/example.org<br />
- ServerName www.example2.org<br />
- <br />
- # Autres directives ici<br />
- <br />
- </indent>
- </VirtualHost>
- </example>
+ <highlight language="config">
+# Apache doit écouter sur le port 80
+Listen 80
+<VirtualHost *:80>
+ DocumentRoot /www/example1
+ ServerName www.example.com
+
+ # Autres directives ici
+</VirtualHost>
+
+<VirtualHost *:80>
+ DocumentRoot /www/example2
+ ServerName www.example.org
+
+ # Autres directives ici
+</VirtualHost>
+ </highlight>
+
<p>Les astérisques correspondent à toutes les adresses, si bien que
le serveur principal ne répondra jamais à aucune requête. Comme le
(<code>172.20.30.50</code>), deux serveurs virtuels (ou plus)
répondront.</p>
- <example>
- <title>Configuration du serveur</title>
-
- Listen 80<br />
- <br />
- # Serveur "principal" sur 172.20.30.40<br />
- ServerName server.example.com<br />
- DocumentRoot /www/mainserver<br />
- <br />
- <VirtualHost 172.20.30.50><br />
- <indent>
- DocumentRoot /www/example.com<br />
- ServerName www.example.com<br />
- <br />
- # D'autres directives ici ...<br />
- <br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.50><br />
- <indent>
- DocumentRoot /www/example.org<br />
- ServerName www.example.org<br />
- <br />
- # D'autres directives ici ...<br />
- <br />
- </indent>
- </VirtualHost>
- </example>
+ <highlight language="config">
+Listen 80
+
+# Serveur "principal" sur 172.20.30.40
+ServerName server.example.com
+DocumentRoot /www/mainserver
+
+<VirtualHost 172.20.30.50>
+ DocumentRoot /www/example1
+ ServerName www.example.com
+
+ # D'autres directives ici ...
+</VirtualHost>
+
+<VirtualHost 172.20.30.50>
+ DocumentRoot /www/example2
+ ServerName www.example.org
+
+ # D'autres directives ici ...
+</VirtualHost>
+ </highlight>
<p>Toute requête arrivant sur une autre adresse que
<code>172.20.30.50</code> sera servie par le serveur principal.
aux requêtes internes et externes, au moyen d'une seule section
<code>VirtualHost</code>.</p>
- <example>
- <title>Configuration du serveur</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>Ainsi, les requêtes en provenance de chacun des deux réseaux
seront servies par le même <code>VirtualHost</code>.</p>
la sélection de la meilleure correspondance du point de vue adresse
IP/port.</p>
- <example>
- <title>Configuration du serveur</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>
et <code>172.20.30.50</code>) correspondant respectivement aux noms
<code>www.example.com</code> et <code>www.example.org</code>.</p>
- <example>
- <title>Configuration du serveur</title>
-
- Listen 80<br />
- <br />
- <VirtualHost 172.20.30.40><br />
- <indent>
- DocumentRoot /www/example.com<br />
- ServerName www.example1.com<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.50><br />
- <indent>
- DocumentRoot /www/example.org<br />
- ServerName www.example2.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>Les requêtes provenant d'adresses non spécifiées dans l'une des
directives <code><VirtualHost></code> (comme pour
Pour chacun d'eux, nous voulons un hébergement sur les ports 80
et 8080.</p>
- <example>
- <title>Configuration du serveur</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/example.com-80<br />
- ServerName www.example.com<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.40:8080><br />
- <indent>
- DocumentRoot /www/example.com-8080<br />
- ServerName www.example.com<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.50:80><br />
- <indent>
- DocumentRoot /www/example.org-80<br />
- ServerName www.example.org<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.50:8080><br />
- <indent>
- DocumentRoot /www/example.org-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>
section un serveur virtuel sélectionnable uniquement en fonction de
son adresse IP.</p>
- <example>
- <title>Configuration du serveur</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 />
- # "par-IP"<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>
transfert, au cas où plusieurs noms de domaines cohabitent sur
une même 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>
d'adresses IP ou de ports non connus, <em>c'est-à-dire</em>, d'un
couple adresse/port non traité par aucun autre serveur virtuel.</p>
- <example>
- <title>Configuration du serveur</title>
-
- <VirtualHost _default_:*><br />
- <indent>
- DocumentRoot /www/default<br />
- </indent>
- </VirtualHost>
- </example>
+ <highlight language="config">
+<VirtualHost _default_:*>
+ DocumentRoot /www/default
+</VirtualHost>
+ </highlight>
<p>L'utilisation d'un tel serveur virtuel avec un joker pour le
port empêche de manière efficace qu'une requête n'atteigne le
le serveur écoute sur plusieurs ports et un second serveur virtuel
<code>_default_</code> pour le port 80 est ajouté.</p>
- <example>
- <title>Configuration du serveur</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>Le serveur virtuel par défaut défini pour le port 80 (il doit
impérativement être placé avant un autre serveur virtuel par
<p>Nous voulons créer un serveur virtuel par défaut seulement
pour le port 80.</p>
- <example>
- <title>Configuration du serveur</title>
-
- <VirtualHost _default_:80><br />
- DocumentRoot /www/default<br />
- ...<br />
- </VirtualHost>
- </example>
+ <highlight language="config">
+<VirtualHost _default_:80>
+DocumentRoot /www/default
+...
+</VirtualHost>
+ </highlight>
<p>Une requête vers une adresse non spécifiée sur le port 80
sera servie par le serveur virtuel par défaut, et toute autre
adresse IP (<code>172.20.30.50</code>) dans la directive
<code>VirtualHost</code>.</p>
- <example>
- <title>Configuration du serveur</title>
-
- Listen 80<br />
- ServerName www.example.com<br />
- DocumentRoot /www/example.com<br />
- <br />
- <VirtualHost 172.20.30.40 172.20.30.50><br />
- <indent>
- DocumentRoot /www/example.org<br />
- ServerName www.example.org<br />
- # ...<br />
- </indent>
- </VirtualHost><br />
- <br />
- <VirtualHost 172.20.30.40><br />
- <indent>
- DocumentRoot /www/example.net<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>Le serveur virtuel peut maintenant être joint par la nouvelle
adresse (comme un serveur virtuel par IP) et par l'ancienne
des liens dont les URLs auront un préfixe identifiant les serveurs
virtuels par nom.</p>
- <example>
- <title>Configuration du serveur</title>
-
- <VirtualHost 172.20.30.40><br />
- <indent>
- # Serveur virtuel primaire<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>
+ # serveur virtuel primaire
+ 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>À cause de la directive
<directive module="core">ServerPath</directive>, une requête sur
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1174747:1334000 (outdated) -->
+<!-- English Revision : 1334000 -->
<!-- French translation by Vincent Deffontaines, review by alain B -->
+<!-- Updated by Lucien Gentis -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
variable <code>%v</code>. Ajoutez cette variable au début de la chaîne
de définition du format de journalisations :</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>Cette configuration va provoquer la création d'un fichier de
journalisation au format standard (CLF : 'Common Log Format'), mais dont
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1301400:1334408 (outdated) -->
+<!-- English Revision: 1334408 -->
<!-- French translation by alain B, review by Vincent Deffontaines
updated by Lucien GENTIS -->
la même adresse IP. Il vous suffit d'ajouter la configuration
suivante à <code>httpd.conf</code> :</p>
- <example>
- <VirtualHost *:80><br />
- <indent>
- # Le premier serveur virtuel de la liste est aussi le
- # serveur par défaut pour *: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>
+ # Le premier serveur virtuel de la liste est aussi le
+ # serveur par défaut pour *:80
+ ServerName www.example.com
+ ServerAlias example.com
+ DocumentRoot /www/domain
+</VirtualHost>
+
+<VirtualHost *:80>
+ ServerName other.example.com
+ DocumentRoot /www/otherdomain
+</VirtualHost>
+ </highlight>
<p>Autrement, vous pouvez spécifiez une adresse IP explicite
à la place de <code>*</code> dans la directive
indique aux utilisateurs les autres noms permis pour accéder au
même site Web :</p>
- <example>
+ <highlight language="config">
ServerAlias example.com *.example.com
- </example>
+ </highlight>
<p>ainsi, toutes les requêtes portant sur un domaine
<code>example.com</code> seront servies par le serveur virtuel