diff options
Diffstat (limited to 'docs/manual/vhosts/examples.html.fr')
-rw-r--r-- | docs/manual/vhosts/examples.html.fr | 531 |
1 files changed, 241 insertions, 290 deletions
diff --git a/docs/manual/vhosts/examples.html.fr b/docs/manual/vhosts/examples.html.fr index 9b155390..3e800373 100644 --- a/docs/manual/vhosts/examples.html.fr +++ b/docs/manual/vhosts/examples.html.fr @@ -8,10 +8,13 @@ <title>Exemples d'utilisations de VirtualHost - Serveur Apache HTTP</title> <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 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> + <link href="../images/favicon.ico" rel="shortcut icon" /></head> <body id="manual-page"><div id="page-header"> -<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossaire</a> | <a href="../sitemap.html">Plan du site</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">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p> <p class="apache">Serveur Apache HTTP Version 2.4</p> <img alt="" src="../images/feather.gif" /></div> <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> @@ -56,7 +59,7 @@ par nom en un serveur virtuel par IP</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">Utilisation de la directive <code>ServerPath</code></a></li> -</ul></div> +</ul><ul class="seealso"><li><a href="#comments_section">Commentaires</a></li></ul></div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="purename" id="purename">Fonctionnement de plusieurs serveurs @@ -77,33 +80,25 @@ que sur la machine possédant ces entrées.</p> </div> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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 - # Apache doit écouter sur le port 80<br /> - Listen 80<br /> - <br /> - <br /> - <VirtualHost *:80><br /> - <span class="indent"> - DocumentRoot /www/example.com<br /> - ServerName www.example1.com<br /> - <br /> - # Autres directives ici<br /> - <br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost *:80><br /> - <span class="indent"> - DocumentRoot /www/example.org<br /> - ServerName www.example2.org<br /> - <br /> - # Autres directives ici<br /> - <br /> - </span> - </VirtualHost> - </code></p></div> + # Autres directives ici +</VirtualHost> + </pre> + + <p>Les astérisques correspondent à toutes les adresses, si bien que le serveur principal ne répondra jamais à aucune requête. Comme le @@ -155,35 +150,28 @@ (<code>172.20.30.50</code>), deux serveurs virtuels (ou plus) répondront.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> + <pre class="prettyprint lang-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> + </pre> - 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 /> - <span class="indent"> - DocumentRoot /www/example.com<br /> - ServerName www.example.com<br /> - <br /> - # D'autres directives ici ...<br /> - <br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50><br /> - <span class="indent"> - DocumentRoot /www/example.org<br /> - ServerName www.example.org<br /> - <br /> - # D'autres directives ici ...<br /> - <br /> - </span> - </VirtualHost> - </code></p></div> <p>Toute requête arrivant sur une autre adresse que <code>172.20.30.50</code> sera servie par le serveur principal. @@ -209,18 +197,14 @@ aux requêtes internes et externes, au moyen d'une seule section <code>VirtualHost</code>.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <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> - <br /> - <VirtualHost 192.168.1.1 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/server1<br /> - ServerName server.example.com<br /> - ServerAlias server<br /> - </span> - </VirtualHost> - </code></p></div> <p>Ainsi, les requêtes en provenance de chacun des deux réseaux seront servies par le même <code>VirtualHost</code>.</p> @@ -247,40 +231,31 @@ la sélection de la meilleure correspondance du point de vue adresse IP/port.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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> + </pre> - Listen 80<br /> - Listen 8080<br /> - <br /> - <VirtualHost 172.20.30.40:80><br /> - <span class="indent"> - ServerName www.example.com<br /> - DocumentRoot /www/domain-80<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <span class="indent"> - ServerName www.example.com<br /> - DocumentRoot /www/domain-8080<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:80><br /> - <span class="indent"> - ServerName www.example.org<br /> - DocumentRoot /www/otherdomain-80<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <span class="indent"> - ServerName www.example.org<br /> - DocumentRoot /www/otherdomain-8080<br /> - </span> - </VirtualHost> - </code></p></div> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -290,25 +265,20 @@ et <code>172.20.30.50</code>) correspondant respectivement aux noms <code>www.example.com</code> et <code>www.example.org</code>.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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> + </pre> - Listen 80<br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/example.com<br /> - ServerName www.example1.com<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50><br /> - <span class="indent"> - DocumentRoot /www/example.org<br /> - ServerName www.example2.org<br /> - </span> - </VirtualHost> - </code></p></div> <p>Les requêtes provenant d'adresses non spécifiées dans l'une des directives <code><VirtualHost></code> (comme pour @@ -326,42 +296,33 @@ Pour chacun d'eux, nous voulons un hébergement sur les ports 80 et 8080.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <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 + +<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> + </pre> - 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 /> - <span class="indent"> - DocumentRoot /www/example.com-80<br /> - ServerName www.example.com<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40:8080><br /> - <span class="indent"> - DocumentRoot /www/example.com-8080<br /> - ServerName www.example.com<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50:80><br /> - <span class="indent"> - DocumentRoot /www/example.org-80<br /> - ServerName www.example.org<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.50:8080><br /> - <span class="indent"> - DocumentRoot /www/example.org-8080<br /> - ServerName www.example.org<br /> - </span> - </VirtualHost> - </code></p></div> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -373,46 +334,35 @@ section un serveur virtuel sélectionnable uniquement en fonction de son adresse IP.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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> + </pre> - Listen 80<br /> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/example1<br /> - ServerName www.example.com<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/example2<br /> - ServerName www.example.org<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/example3<br /> - ServerName www.example.net<br /> - </span> - </VirtualHost><br /> - <br /> - # "par-IP"<br /> - <VirtualHost 172.20.30.50><br /> - <span class="indent"> - DocumentRoot /www/example4<br /> - ServerName www.example.edu<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.60><br /> - <span class="indent"> - DocumentRoot /www/example5<br /> - ServerName www.example.gov<br /> - </span> - </VirtualHost> - </code></p></div> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -428,14 +378,15 @@ transfert, au cas où plusieurs noms de domaines cohabitent sur une même machine.</p> - <div class="example"><p><code> - <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> - </code></p></div> + <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> + </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -449,15 +400,12 @@ 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> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-config"> +<VirtualHost _default_:*> + DocumentRoot /www/default +</VirtualHost> + </pre> - <VirtualHost _default_:*><br /> - <span class="indent"> - DocumentRoot /www/default<br /> - </span> - </VirtualHost> - </code></p></div> <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 @@ -485,23 +433,18 @@ le serveur écoute sur plusieurs ports et un second serveur virtuel <code>_default_</code> pour le port 80 est ajouté.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-config"> +<VirtualHost _default_:80> + DocumentRoot /www/default80 + # ... +</VirtualHost> + +<VirtualHost _default_:*> + DocumentRoot /www/default + # ... +</VirtualHost> + </pre> - <VirtualHost _default_:80><br /> - <span class="indent"> - DocumentRoot /www/default80<br /> - # ...<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost _default_:*><br /> - <span class="indent"> - DocumentRoot /www/default<br /> - # ...<br /> - </span> - </VirtualHost> - </code></p></div> <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 @@ -516,14 +459,13 @@ <p>Nous voulons créer un serveur virtuel par défaut seulement pour le port 80.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-config"> +<VirtualHost _default_:80> +DocumentRoot /www/default +... +</VirtualHost> + </pre> - <VirtualHost _default_:80><br /> - DocumentRoot /www/default<br /> - ...<br /> - </VirtualHost> - </code></p></div> <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 @@ -550,30 +492,25 @@ adresse IP (<code>172.20.30.50</code>) dans la directive <code>VirtualHost</code>.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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> + </pre> - Listen 80<br /> - ServerName www.example.com<br /> - DocumentRoot /www/example.com<br /> - <br /> - <VirtualHost 172.20.30.40 172.20.30.50><br /> - <span class="indent"> - DocumentRoot /www/example.org<br /> - ServerName www.example.org<br /> - # ...<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - DocumentRoot /www/example.net<br /> - ServerName www.example.net<br /> - ServerAlias *.example.net<br /> - # ...<br /> - </span> - </VirtualHost> - </code></p></div> <p>Le serveur virtuel peut maintenant être joint par la nouvelle adresse (comme un serveur virtuel par IP) et par l'ancienne @@ -595,41 +532,34 @@ des liens dont les URLs auront un préfixe identifiant les serveurs virtuels par nom.</p> - <div class="example"><h3>Configuration du serveur</h3><p><code> - + <pre class="prettyprint lang-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> + </pre> - <VirtualHost 172.20.30.40><br /> - <span class="indent"> - # Serveur virtuel primaire<br /> - DocumentRoot /www/subdomain<br /> - RewriteEngine On<br /> - RewriteRule . /www/subdomain/index.html<br /> - # ...<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - DocumentRoot /www/subdomain/sub1<br /> - <span class="indent"> - ServerName www.sub1.domain.tld<br /> - ServerPath /sub1/<br /> - RewriteEngine On<br /> - RewriteRule ^(/sub1/.*) /www/subdomain$1<br /> - # ...<br /> - </span> - </VirtualHost><br /> - <br /> - <VirtualHost 172.20.30.40><br /> - <span class="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 /> - </span> - </VirtualHost> - </code></p></div> <p>À cause de la directive <code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code>, une requête sur @@ -655,7 +585,28 @@ <a href="../ja/vhosts/examples.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/vhosts/examples.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | <a href="../tr/vhosts/examples.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> -</div><div id="footer"> +</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Commentaires</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/vhosts/examples.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> <p class="apache">Copyright 2012 The Apache Software Foundation.<br />Autorisé sous <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">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p></div> +<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">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> </body></html>
\ No newline at end of file |