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