Comment héberger un site sous apache2 (ubuntu

lamou23 -  
InAme19 Messages postés 539 Date d'inscription   Statut Membre Dernière intervention   -
salut,

j'ai installé apache2 sous ubuntu 9.04.

je voulais héberger un site localement pour que je puisse y accéder à travers l'url:


donc j'ai créé un virtual host comme suit:

[CODE]<VirtualHost 192.168.137.1:80>
ServerAdmin postmaster@test2.dz
DocumentRoot /var/www/test2
ServerName www.test2.dz
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/test2>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>[/CODE]

192.168.137.1 est l'adresse ip de ma machine ubuntu.

j'ai rajouté la ligne suivante à /etc/apache2/httpd.conf:
[CODE]DirectoryIndex index.html index.htm index.xhtml index.php[/CODE]

puis j'ai activé le site avec:
[CODE]sudo a2ensite test2.gz[/CODE]

et j'ai redémarré le service apache2:
[CODE]sudo /etc/init.d/apache2 restart[/CODE]

aprés j'ai créé le dossier /var/www/test2 , et j'ai créé dedans un fichier "index.php" contenant:
[CODE]<? echo "Bonjour ?>[/CODE]

quand je tape dans l'url "www.test2.dz", il m'affiche:
[CODE][CODE]It works![/CODE][/CODE]


et quand je tape[CODE] www.test2.dz/index.php[/CODE] il m'affiche pas le contenu du fichier index.php.


pourriez vous m'aider à afficher le contenu du répertoire du site créé à partir de l'url?

merci d'avance
A voir également:

1 réponse

InAme19 Messages postés 539 Date d'inscription   Statut Membre Dernière intervention   62
 
Bon si tu as "It's work" lorsque tu vas sur localhost c'est déjà bon signe.

d'abord essaye de remplacer <? echo "Bonjour ?>
par <?php echo "Bonjour ?> dans ton fichier index.php


as tu édité le fichier /etc/hosts?

tu dois y ajouter :
127.0.0.1 test2.gz
0