Bonjour,
Je vais bientôt héberger plusieurs sites sur mon serveur (qui comporteront eux-mêmes des sous-domaines) et, malgré mes nombreuses recherches, je n'arrive pas à faire fonctionner les Virtual Hosts sur le serveur.
Jusqu'à maintenant je fonctionnais avec le fichier "default" présent dans le dossier /etc/apache2/sites-available.
J'ai rajouté un fichier "site01" pour faire un essai mais rien ne fonctionne : quand je tape www.site01.org, je suis envoyé vers /var/www au lieu de /var/www/site01.
Voici le fichier "default" (fichier présent à l'installation d'apache 2 sous Debian) :
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride AuthConfig
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Et voici mon fichier "site01" (je précise que j'ai bien créé le lien symbolique) :
NameVirtualHost site01.org
<VirtualHost site01.org:80>
ServerName www.site01.org
#ServerAlias www.site01.org
DocumentRoot /var/www/site01/
<Directory /var/www/site01/>
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/site01.org/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/site01.org_error.log
LogLevel warn
CustomLog /var/log/apache2/site01.org_access.log combined
ServerSignature Off
</VirtualHost>
Pour le moment, le Virtual Host de "Site01" est maigre, c'est fait exprès. Je m'attaquerai aux alias et sous-domaines de chaque site une fois que le Vhost de Site01 fonctionnera bien :-)
Je vous remercie par avance de votre aide.
Caractéristiques : Debian Sarge, Apache 2.
Poste le Friday 21 April 2006 19:00:47