Virtual Host » History » Version 6
  Simon, 10/28/2008 04:38 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 | 6 | Simon | AliasMatch ^\.\./(.*) /htdocs/linea21_v1/$1 | 
| 22 | 1 | Simon | |
| 23 | <Directory "/htdocs/linea21_v1/public"> | ||
| 24 | AllowOverride All | ||
| 25 | Allow from All | ||
| 26 | </Directory> | ||
| 27 | </VirtualHost> | ||
| 28 | }}} | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | 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 : | 
| 33 | 1 | Simon | |
| 34 | 5 | Simon | |
| 35 | |||
| 36 | 1 | Simon | {{{ | 
| 37 | 127.0.0.1 linea21_v1 | ||
| 38 | }}} | ||
| 39 | |||
| 40 | |||
| 41 | 5 | Simon | '''3 -''' Mettez à jour le fichier ''/public/.htaccess'' de l'application. | 
| 42 | |||
| 43 | |||
| 44 | Commentez la configuration par défaut et décommentez la configuration pour Virtual Host : | ||
| 45 | {{{ | ||
| 46 | ## Default configuration | ||
| 47 | #ErrorDocument 404 /linea21/public/rewrite.php | ||
| 48 | |||
| 49 | ## Virtual Host configuration | ||
| 50 | ErrorDocument 404 /rewrite.php | ||
| 51 | }}} | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | '''4 -''' Le '''serveur Apache doit être redémarré''' pour que les modifications soient prises en compte. | ||
| 56 | 1 | Simon | |
| 57 | |||
| 58 | Plus d'informations sur les Virtual Host Apache, en ligne : | ||
| 59 | |||
| 60 | * http://httpd.apache.org/docs/2.0/vhosts/ | ||
| 61 | * http://httpd.apache.org/docs/2.2/fr/vhosts/ (français) |