1

I have a problem with my Apache2, I'm probably doing a misconfiguration, but I do not get what.

All my https traffic always redirects to a single page, I can't add different https pages.

This is my config :

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews ExecCGI
                AllowOverride All
                Order allow,deny
                allow from all
                AddHandler cgi-script .py
        </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>


  <VirtualHost *:80>
    DocumentRoot /var/www/www1/
    ServerName www1.lucas.myurl.be
    </VirtualHost>

  <VirtualHost *:80>
    DocumentRoot /var/www/www2/
    ServerName www2.lucas.myurl.be
    </VirtualHost>

<VirtualHost *:443>
    DocumentRoot /usr/share/roundcube/
    ServerName webmail.lucas.myurl.be
    SSLEngine on
    SSLCertificateFile PlaceOFMy1stCert
    SSLCertificateKeyFile PlaceOfMy1stKey
  </VirtualHost>

 <VirtualHost *:80>
   DocumentRoot /usr/share/roundcube/
    ServerName webmail.lucas.myurl.be
    Redirect / https://webmail.lucas.myurl.be/
</VirtualHost>

 <VirtualHost *:443>
    DocumentRoot /var/www
    ServerName secure.lucas.myurl.be
    SSLEngine on
    SSLCertificateFile My2ndCert
    SSLCertificateKeyFile My2ndKey
    </VirtualHost>


 <VirtualHost *:80>
    DocumentRoot /var/www
    ServerName secure.lucas.myurl.be
    Redirect / https://secure.lucas.myurl.be/
</VirtualHost>

The problem is I get a default overwrite warning when I restart Apache2, but I do not understand where it is coming from.

 [warn] _default_ VirtualHost overlap on port 443, the first has precedence
httpd not running, trying to start

So when I go to secure.lucas.myurl.be it goes to https://webmail.lucas.myurl.be, instead of going to https://secure.lucas.myurl.be

So what do I need to add to my configuration to make it redirect to the the proper SSL page instead of redirecting everything to the first 443 redirect ?

2 Answers 2

1

Quite normal issue. You can only have one SSL Certificate per IP. You here have 2 SSL blocks on all interfaces so apache will only take the first.

It is also possible that you still have your default SSL vhost enabled 2.

Check which vhosts are enabled by using this command:

 apache2ctl -S

This will give you a list.

You can have multiple SSL blocks on 1 ip , but it has to use the same certificate for all blocks.

1
  • You can have multiple SSL certificates per IP if you use different ports per certificate. But of course then you'd have to have something in front of your webservers (loadbalancer possibly) that directed port 443 traffic to the correct server port based on domain name. You can also buy a UCC SSL certificate to have multiple domains inside a single certificate. Oct 5, 2011 at 13:24
2

It sounds like SNI is not enabled. That would explain why they all go to the same page. If you are running Debian Lenny or Debian Squeeze I believe that it will work.

Check out this page It describes how to enable SNI on your hosts. Note this is used with NameBased Virtual hosts. From your configuration it looks as though you are using Named virtual hosts.

3
  • 1
    I changed to namevirtualhosts, it works now :) Oct 5, 2011 at 12:57
  • I wasn't aware of SNI, that's pretty cool. I'd be wary of using it though since the older browsers don't seem to support it (hi IE6). Oct 5, 2011 at 13:28
  • I believe the some patches to IE6 may have added SNI support.
    – Squidly
    Oct 5, 2011 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .