Apache2, VirtualHosts, SSL, Mutli Domain Certificate

apache-2.2ssl-certificatevirtualhost

I have a debian server with one IP and three projects linking to the same folder. Within the VirtualHosts I have some different alliases. I now want to redirect some parts to HTTPS. For one project this works fine (see below) but I have problems for the other projects. I have a Multi Domain Certificate for all three projects.

Module ssl und rewrite are working.

NameVirtualHost *
Listen 80
Listen 443


<Directory /home/projekt/>
   Allow from all
   AllowOverride All
   Order allow,deny
   Options FollowSymLinks
</Directory>

<VirtualHost *:80>
   ServerAdmin     support@projekt
   DocumentRoot    "/home/projekt/cfdocs"
   ServerName      local-projekt.com
[..]
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin     support@projekt
   DocumentRoot    "/home/projekt/cfdocs"
   ServerName      projekt-de.com
[..]
</VirtualHost>

<VirtualHost staticIP:443>
   ServerAdmin     support@projekt
   DocumentRoot    "/home/projekt/cfdocs"
   ServerName      projekt-de.com

   SSLEngine On
   SSLCertificateFile /etc/ssl/www_.crt
   SSLCertificateKeyFile /etc/ssl/www_.key
   SSLCertificateChainFile /etc/ssl/www_.ca-bundle
   ServerSignature On

[..]
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin     support@projekt
   DocumentRoot    "/home/projekt/cfdocs"
   ServerName      projekt-fr.com
[..]
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin     support@projekt
   DocumentRoot    "/home/projekt/cfdocs"
   ServerName      projekt-it.com
[..]
</VirtualHost>

As I said, this works for projekt-de fine. But I cannot copy the VirtualHost for the other projects, the error message is

"VirtualHost staticIP:443 overlaps with VirtualHost staticIP:443, the first has
precedence, perhaps you need a NameVirtualHost directive"

I am not sure, what this means.. I read the documentation and I thought http://213.11.80.10/manual/vhosts/examples.html#ipport is the same thing as I have / need.

Thanks for any hints, I already spent some hours with testing..

Best Answer

Try swap the first line of the config for:

NameVirtualHost *:80
NameVirtualHost staticIP:443

as the argument to the VirtualHost directive must exactly match the argument to the NameVirtualHost directive

Related Topic