Virtual Host » History » Version 9
  Anthony, 10/16/2009 11:48 AM 
  
| 1 | 1 | Simon | |
|---|---|---|---|
| 2 | |||
| 3 | |||
| 4 | 9 | Anthony | h1. Configurer un Virtual Host - Apache | 
| 5 | 1 | Simon | |
| 6 | |||
| 7 | 9 | Anthony | |
| 8 | |||
| 9 | 1 | Simon | L' interface publique de l'application est accessible par défaut à l'adresse suivante : http://domaine.tld/linea21/public/ | 
| 10 | |||
| 11 | Pour y accéder depuis http://www.monsite.com/, créez un virtualhost apache. | ||
| 12 | |||
| 13 | 9 | Anthony | *1 -* Ajouter à la fin de votre fichier _httpd.conf_ : | 
| 14 | 1 | Simon | |
| 15 | |||
| 16 | Exemple de configuration en local : | ||
| 17 | 9 | Anthony | <pre> | 
| 18 | 1 | Simon | <VirtualHost 127.0.0.1:80> | 
| 19 | 9 | Anthony | [[ServerName]] linea21_v1 | 
| 20 | [[DocumentRoot]] /htdocs/linea21_v1/public | ||
| 21 | [[DirectoryIndex]] index.php | ||
| 22 | [[ErrorLog]] linea21_v1_log | ||
| 23 | 1 | Simon | Alias "/lib" /htdocs/linea21_v1/lib | 
| 24 | 7 | Simon | Alias "/gfx" /htdocs/linea21_v1/gfx | 
| 25 | Alias "/dashboard/graph.php" /htdocs/linea21_v1/dashboard/graph.php | ||
| 26 | 1 | Simon | Alias "/publication/contents" /htdocs/linea21_v1/publication/contents | 
| 27 | 7 | Simon | Alias "/news/input" /htdocs/linea21_v1/news/input | 
| 28 | 1 | Simon | Alias "/user/avatar" /htdocs/linea21_v1/user/avatar | 
| 29 | |||
| 30 | <Directory "/htdocs/linea21_v1/public"> | ||
| 31 | 9 | Anthony | [[AllowOverride]] All | 
| 32 | 1 | Simon | Allow from All | 
| 33 | </Directory> | ||
| 34 | </VirtualHost> | ||
| 35 | 9 | Anthony | </pre> | 
| 36 | 1 | Simon | |
| 37 | 5 | Simon | |
| 38 | 1 | Simon | |
| 39 | 9 | Anthony | *2 -* Si vous paramétrez un Virtual Host en local, n'oubliez pas de mettre à jour votre fichier _/etc/hosts_. Dans ce cas : | 
| 40 | 5 | Simon | |
| 41 | 1 | Simon | |
| 42 | |||
| 43 | 9 | Anthony | <pre> | 
| 44 | 1 | Simon | 127.0.0.1 linea21_v1 | 
| 45 | 9 | Anthony | </pre> | 
| 46 | 5 | Simon | |
| 47 | 1 | Simon | |
| 48 | 9 | Anthony | *3 -* Mettez à jour le fichier _/public/.htaccess_ de l'application. | 
| 49 | 5 | Simon | |
| 50 | 1 | Simon | |
| 51 | Commentez la configuration par défaut et décommentez la configuration pour Virtual Host : | ||
| 52 | 9 | Anthony | <pre> | 
| 53 | 5 | Simon | ## Default configuration | 
| 54 | 1 | Simon | #ErrorDocument 404 /linea21/public/rewrite.php | 
| 55 | 5 | Simon | |
| 56 | ## Virtual Host configuration | ||
| 57 | 9 | Anthony | [[ErrorDocument]] 404 /rewrite.php | 
| 58 | </pre> | ||
| 59 | 5 | Simon | |
| 60 | 8 | Anthony | |
| 61 | 9 | Anthony | *3 -* Mettez à jour le fichier _/.htaccess_ de l'application. | 
| 62 | 8 | Anthony | |
| 63 | |||
| 64 | Commentez la configuration par défaut et décommentez la configuration pour Virtual Host : | ||
| 65 | 9 | Anthony | <pre> | 
| 66 | 8 | Anthony | ## Error management - Default location | 
| 67 | #ErrorDocument 404 /linea21/public/error.php | ||
| 68 | |||
| 69 | ## Error management - Virtual Host configuration | ||
| 70 | 9 | Anthony | [[ErrorDocument]] 404 /public/error.php | 
| 71 | </pre> | ||
| 72 | 8 | Anthony | |
| 73 | 5 | Simon | |
| 74 | |||
| 75 | 9 | Anthony | *4 -* Le *serveur Apache doit être redémarré* pour que les modifications soient prises en compte. | 
| 76 | 1 | Simon | |
| 77 | |||
| 78 | Plus d'informations sur les Virtual Host Apache, en ligne : | ||
| 79 | |||
| 80 | 9 | Anthony | * http://httpd.apache.org/docs/2.0/vhosts/ | 
| 81 | * http://httpd.apache.org/docs/2.2/fr/vhosts/ (français) |