Probleme config apache vhost

Bonjour à tous,

alors voila mon soucis apres avoir créer des vhosts dans la config d’apache je l’ai relancé pour qu’il les prenent en compte mais j’obtiens une erreur:

[code]# invoke-rc.d apache2 reload

  • Reloading web server config… 26215
    [Wed Dec 05 09:25:55 2007] [warn] VirtualHost postfixadmin:80 overlaps with VirtualHost www:80, the first has precedence, perhaps you need a NameVirtualHost directive
    [Wed Dec 05 09:25:55 2007] [warn] VirtualHost phpmyadmin:80 overlaps with VirtualHost postfixadmin:80, the first has precedence, perhaps you need a NameVirtualHost directive
    [Wed Dec 05 09:25:55 2007] [warn] VirtualHost mail:80 overlaps with VirtualHost phpmyadmin:80, the first has precedence, perhaps you need a NameVirtualHost directive
    [/code]

j’ai créé des fichiers differents pour chaque vhost en partant du fichier default :

ls /etc/apache2/sites-available/ default mail-gdh phpmyadmin postfixadmin ssl www

puis j’ai créé le lien symbolique :

ls /etc/apache2/sites-enabled/ 000-default mail-gdh phpmyadmin postfixadmin ssl www

voici le contenu d’un des trois vhosts :

#NameVirtualHost phpmyadmin.garde-dhonneur.com
<VirtualHost phpmyadmin:80>
        ServerAdmin gangan@zalteam.com

        DocumentRoot /var/www/phpmyadmin/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/phpmyadmin/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                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 None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error-phpmyadmin.log

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

        CustomLog /var/log/apache2/access-phpmyadmin.log combined
        ServerSignature On

    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>

up :smt006

Dans ton apache2.conf, as-tu bien mis la directive:

Et, bien sûr, /etc/init.d/apache2 reload :wink:

je le rajoute ou dans le fichier apache2.conf ? ce NameVirtualHost *

Où tu veux, l’ordre des directives n’a pas trop d’importance.

je l’ai rajouté dans apache2.conf le NameVirtualHost *

invoke-rc.d apache2 reload

* Reloading web server config... 26215 [Thu Dec 06 12:00:40 2007] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Thu Dec 06 12:00:40 2007] [warn] VirtualHost phpmyadmin.garde-dhonneur.com:80 overlaps with VirtualHost www.garde-dhonneur.com:80, the first has precedence, perhaps you need a NameVirtualHost directive [Thu Dec 06 12:00:40 2007] [warn] VirtualHost mail.garde-dhonneur.com:80 overlaps with VirtualHost phpmyadmin.garde-dhonneur.com:80, the first has precedence, perhaps you need a NameVirtualHost directive [Thu Dec 06 12:00:40 2007] [warn] NameVirtualHost *:0 has no VirtualHosts

L’erreur est différente cette fois. Apparemment un conflit ou redondance de port (80). Essaye de faire
plutôt que dans tes fichiers virtual host

essaye ca

<VirtualHost *>
ServerAdmin gangan@zalteam.com
DocumentRoot "/var/www/phpmyadmin/"
ServerName phpmyadmin.garde-dhonneur.com
ErrorLog "/var/log/apache2/phpmyadmin-error.log"
CustomLog "/var/log/apache2/phpmyadmin-access.log" combined

<Directory /var/www/phpmyadmin>
Options -Indexes  
AllowOverride AuthConfig FileInfo Limit
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

[quote=“AigletoN”]essaye ca

<VirtualHost *> ... </VirtualHost> [/quote]

Effectivement, il faut le wild card dans <Virtualhost *>

Finger trouble error! :wink:

visiblement ca va un peu mieux j’ai 4 fichiers dans sites-available ecrient comme ceci (pour mail,postfixadmin,phpmyadmin etc…):

<VirtualHost *>
        ServerAdmin gangan@zalteem.com
        DocumentRoot /var/www/postfixadmin/
        ServerName postfixadmin.mondomain.com
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/postfixadmin/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                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 None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error-postfixadmin.log

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

        CustomLog /var/log/apache2/access-postfixadmin.log combined
        ServerSignature On

    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>

il me reste plus qu’une petite erreur

invoke-rc.d apache2 reload

  • Reloading web server config… 26215
    [Fri Dec 07 09:38:31 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
    [ OK ]
<VirtualHost *>
ServerAdmin gangan@zalteem.com
DocumentRoot "/var/www/postfixadmin/"
ServerName postfixadmin.mondomain.com
ErrorLog "/var/log/apache2/error-postfixadmin.log"
CustomLog "/var/log/apache2/access-postfixadmin.log" combined

<Directory /var/www/postfixadmin/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo Limit
Order allow,deny
allow from all
</Directory>
</VirtualHost>

rajouter des " manquant, virer :

Options FollowSymLinks
AllowOverride None

toujours pareil en tous cas merci pour ton aide

invoke-rc.d apache2 reload

  • Reloading web server config… 26215
    [Fri Dec 07 11:24:52 2007] [warn] NameVirtualHost *:0 has no VirtualHosts

Va faire un tour par là
wiki.goldzoneweb.info/doku.php?i … s_basiques

cool ton lien y a d’autres trucs interessant

c’est dur dur lol

NameVirtualHost *
<VirtualHost *>
        ServerAdmin gangan@zalteam.com
        DocumentRoot "/var/www/postfixadmin/"
        ServerName postfixadmin.garde-dhonneur.com

        <Directory /var/www/postfixadmin/>
                Options Indexes FollowSymLinks MultiViews

[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:443 has no VirtualHosts
[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Fri Dec 07 14:38:59 2007] [warn] NameVirtualHost *:0 has no VirtualHosts

Tu peux préciser le port du virtualhost en mettant

<VirtualHost *:80>

par exemple, ça permet de préciser quel port utiliser.

permet de limiter le VirtualHost à l’interface dont l’adresse IP est celle de pouet.com. C’est utile pour les serveurs ayant plusieurs interfaces IP dont l’adresse IP est donné par DHCP et dont les différents serveurs se distinguent par les IPs (à vérifier, Ash devrait confirmer)

tu pourrait mettre tes virtualhost en entier ?
doit y avoir une erreur sur un autre
tu te sert de la conf default pour generer tes virtualhost ou passe tu par la commande a2ensite ?

non chaque fois j’ai copier le fichier default

ils sont tous comme celui la :

NameVirtualHost *
<VirtualHost *>
        ServerAdmin gangan@zalteam.com
        DocumentRoot "/var/www/postfixadmin/"
        ServerName postfixadmin.garde-dhonneur.com

        <Directory /var/www/postfixadmin/>
                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 None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog "/var/log/apache2/error-postfixadmin.log"

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

        CustomLog "/var/log/apache2/access-postfixadmin.log" combined
        ServerSignature On

    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>

sauf ssl qui sort de chez pas ou :

NameVirtualHost *:443
<VirtualHost *:443>
        ServerAdmin root@garde-dhonneur.com
        ServerName www.garde-dhonneur.com
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </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
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                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 On

SSLEngine On
SSLCertificateFile /etc/apache2/ssl/garde-dhonneur.crt
SSLCertificateKeyFile /etc/apache2/ssl/garde-dhonneur.key

SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

Peut être n’as tu pas de site par défaut mais tes VirtualHosts ont l’air corrects… (le site par défaut est celui qui est pris lorsque aucun des virtualhosts ne correspond.

et il se configure comment ?
je dois pas en avoir effectivement

En gros de la même manière, tu rajoutes

DocumentRoot "/var/www" etc..

avant la directive
NameVirtualHost *