Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Serveurs (Apache, IIS,...) > Apache
Apache Forum d'entraide Apache. Avant de poster : Cours Apache, FAQ Apache
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/09/2011, 10h03   #1
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
Par défaut virtualhosts par nom

Bonjour,
ça semble tout bête mais à chaque fois j'ai le problème je l'avais résolu il y a bien longtemps et je ne me rappelle plus comment. J'y ai passé au moins 3 heures sans succès.
J'ai 2 sites hébergés sur un serveur perso sous debian sqeeze, le problème et que quelque soit celui que je demande c'est toujours le même qui s'affiche.

Code :
1
2
3
4
5
6
7
8
9
10
11
 cat /etc/hosts
127.0.0.1       localhost 192.168.0.21
127.0.1.1       serveur
127.0.0.1       diodio13.fr www.diodio13.fr testingbox.fr www.testingbox.fr

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Code :
1
2
 ls /etc/apache2/sites-enabled/
000-default  diodio13.fr  testingbox.fr
Code :
1
2
 ls /var/www/
diodio13fr  index.html  testingbox
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
root@serveur:/etc/apache2/sites-available# cat diodio13.fr
<VirtualHost diodio13.fr>
        ServerAdmin webmaster@localhost
        ServerName diodio13.fr
        ServerAlias www.diodio13.fr

        DocumentRoot /var/www/diodio13fr

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/diodio13fr>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    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>
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
root@serveur:/etc/apache2/sites-available# cat testingbox.fr
<VirtualHost testingbox.fr>
        ServerAdmin webmaster@localhost
        ServerName testingbox.fr
        ServerAlias www.testingbox.fr

        DocumentRoot /var/www/testingbox

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/testingbox>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    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>
httpd.conf est vide et apache2.conf est d'origine.

Si une bonne âme veut bien m'apporter ses lumières car là je sèche. En plus quasiment tous mes recherche g**g** aboutissent à des configurations avec les vHosts dans httpd.conf et non pas un fichier par vHost dans sites-available :/
Merci à vous.
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/09/2011, 21h56   #2
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 293
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 293
Points : 8 579
Points : 8 579
Citation:
Envoyé par diodio13fr Voir le message
quelque soit celui que je demande c'est toujours le même qui s'affiche.
Là, ça doit faire tilt : c'est typique de NameVirtualHost qui manque, et je pense que c'est le cas. Dans ports.conf, ajoute les deux lignes suivantes :
Code :
1
2
NameVirtualHost diodio13.fr
NameVirtualHost testingbox.fr
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/09/2011, 13h14   #3
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
Merci de ton aide, mais cela ne fonctionne toujours pas. Ce coup ci les deux adresses aboutissent au site par defaut d'apache, sur la page /var/www/index.html.
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/09/2011, 21h04   #4
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 293
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 293
Points : 8 579
Points : 8 579
Y a quoi dans ce fichier ports.conf ?
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/09/2011, 01h45   #5
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
Le voilà:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cat /etc/apache2/ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost diodio13.fr
NameVirtualHost testingbox.fr
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
Je viens de me rendre compte que du coup j'ai supprimé la ligne
mais là je ne peux rien y faire, dès que je peux je la remet et reteste.
Merci
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/09/2011, 08h21   #6
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
Bon j'ai encore fais un tas d'essai au pif et ça semble fonctionner!!
voilà les fichiers, si ca peut aider quelqu'un
Code :
1
2
3
4
5
6
7
8
9
10
11
 cat /etc/hosts
127.0.0.1	localhost.localdomain
127.0.1.1	serveur
192.168.0.21	diodio13.fr www.diodio13.fr testingbox.fr www.testingbox.fr

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 cat /etc/apache2/sites-available/diodio13.fr 
<VirtualHost diodio13.fr:80>
	ServerAdmin webmaster@localhost
	ServerName diodio13.fr
	ServerAlias www.diodio13.fr

	DocumentRoot /var/www/diodio13fr

	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/diodio13fr>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    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>
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cat /etc/apache2/sites-available/testingbox.fr 
<VirtualHost testingbox.fr:80>
	ServerAdmin webmaster@localhost
	ServerName testingbox.fr
	ServerAlias www.testingbox.fr

	DocumentRoot /var/www/testingbox

	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/testingbox>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    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>
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cat /etc/apache2/ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
#NameVirtualHost diodio13.fr
#NameVirtualHost testingbox.fr
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
Code :
1
2
ls /etc/apache2/sites-enabled/
000-default  diodio13.fr  testingbox.fr
je referai des essais au réveil la fatigue me guette.....

edit: ben c'est pas tout a fait ca au final....
bon maintenant quand je demande diodio13.fr et testingbox.fr j'arrive où il faut, par contre quand je demande
Code :
www.diodio13.fr et www.testingbox.fr
ben j'arrive sur diodio13.fr .

Bon ce coup ci au lit.
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/09/2011, 13h24   #7
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 293
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 293
Points : 8 579
Points : 8 579
Et avec
Code :
1
2
3
NameVirtualHost *:80
NameVirtualHost diodio13.fr:80
NameVirtualHost testingbox.fr:80
Le plus simple, et de très loin, c'est de ne mettre qu'une ligne
et de mettre partout
à la place de
Code :
<VirtualHost diodio13.fr:80>
et
Code :
<VirtualHost testingbox.fr:80>
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/09/2011, 13h32   #8
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
donc avec:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cat ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
NameVirtualHost diodio13.fr
NameVirtualHost testingbox.fr
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cat sites-available/diodio13.fr 
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName diodio13.fr
	ServerAlias www.diodio13.fr

	DocumentRoot /var/www/diodio13fr

	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/diodio13fr>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    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

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cat sites-available/testingbox.fr 
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName testingbox.fr
	ServerAlias www.testingbox.fr

	DocumentRoot /var/www/testingbox

	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/testingbox>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    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>
Code :
www.diodio13.fr et www.testingbox.fr
aboutissent bien par contre diodio13.fr et testingbox.fr aboutissent sur le site default d'apache.

Merci de passer du temps à m'aider .
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/09/2011, 15h07   #9
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 293
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 293
Points : 8 579
Points : 8 579


Et si tu ne laisses que ?
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/09/2011, 01h35   #10
Invité de passage
 
Inscription : septembre 2008
Messages : 17
Détails du profil
Informations personnelles :
Âge : 34

Informations forums :
Inscription : septembre 2008
Messages : 17
Points : 4
Points : 4
J'ai essayé, ça n'a pas fonctionné. J'ai testé tout un tas de trucs divers et variés sans succès. Du coup j'ai craqué j'ai viré apache et installé nginx ça va beaucoup mieux.
Merci pour ton aide et le temps passé .
diodio13fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h35.


 
 
 
 
Partenaires

Hébergement Web