8791 sujets

Développement web côté serveur, CMS

Salut. Smiley biggrin
J'ai suivi ce tuto pour installer le SSL sur mon serveur mais quelque-chose cloche : en appellant n'importe lequel de mes sous-domaines avec le HTTPS, j'atterris sur mon domaine principal (alors que dans la barre d'adresse, l'URL est bien celle de mon sous-domaine).
Voici certains fichiers clés :

/etc/apache2/ports.conf
NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    Listen 443
</IfModule>


/etc/apache2/site-available/default
<VirtualHost *:80>
        ServerAdmin toto@toto.fr
        ServerName toto.fr
        ServerAlias  www.toto.fr
 
        DocumentRoot /var/www/toto.fr
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/toto.fr>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Deny 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 /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

    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>


/etc/apache2/site-available/default-ssl
<VirtualHost *:443>
        ServerAdmin toto@toto.fr
        ServerName toto.fr
        ServerAlias  www.toto.fr
 
        SSLEngine On
        SSLCertificateFile /etc/ssl/private/localhost.pem
        DocumentRoot /var/www/toto.fr
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/toto.fr>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Deny 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 /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

    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>


Désolé si la réponse vous semble évidente mais je n'ai jamais touché au SSL. Smiley langue
Est-ce qu'il faut créer un certificat par sous-domaine ? Ou bien il faut un VirtualHost pour le HTTP et un autre pour le HTTPS de chaque sous-domaine ?
Merci. Smiley biggrin
Modifié par Lenezir (28 Dec 2009 - 13:19)