Warning when adding multiple VirtualHosts on port 443 - "_default_ VirtualHost overlap on port 443, the first has precedence"
You need to add NameVirtualHost *:443
for it to work.
NameVirtualHost *:80
must also be in your configuration, it is probably set by default, but I don't use Ubuntu so I'm not sure in which file.
Also a word of advice:
Running multiple HTTPS sites on a single IP might have it's drawbacks, specifically older clients (IE8/Windows XP) will not support SNI.
It may make perfect sense in your situation (only for testing, *.example.com wildcard certificate is being used, etc.) but you should be aware of this.
Related videos on Youtube
Sparky
Updated on September 18, 2022Comments
-
Sparky over 1 year
I'm running Ubuntu 12.10 and I have the following 4 VirtualHost entries in
/etc/apache2/apache2.conf
The 4 VirtualHost entries are for 2 separate sites,
test.example.com
andtest2.example.com
, one entry each for HTTP and one for HTTPS.<VirtualHost *:443> DocumentRoot /var/www/test ServerName test.example.com # Other settings goes here </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/test ServerName test.example.com # Other settings goes here </VirtualHost> <VirtualHost *:443> DocumentRoot /var/www/test2 ServerName test2.example.com # Other settings goes here </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/test2 ServerName test2.example.com # Other settings goes here </VirtualHost>
My problem When I save and restart apache, I get this warning:-
* Restarting web server apache2 [Sun Feb 17 18:30:09 2013] [warn] _default_ VirtualHost overlap on port 443, the first has precedence ... waiting [Sun Feb 17 18:30:10 2013] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
And I get the contents of
/var/www/test
when I open bothtest.example.com
andtest2.example.com
Any idea what the problem is?
-
faker over 11 yearsIs
NameVirtualHost *:443
in your configuration? -
Sparky over 11 years@faker, not it was not. I added it and the problem was solved :) Thanks. If you add it as an answer, I can accept it. Also can you tell me why adding it was necessary, since I hadnt added NameVirtualHost *:80 for HTTP and still both the VirtualHosts on port 80 woked?
-
-
Swimburger over 8 yearsI was struggling with this today, everything worked instantly after adding the line. Thank you.
-
ar34z over 8 yearsOn my Ubuntu server I had to add this to
/etc/apache2/ports.conf
. In there,<IfModule mod_ssl.c>
already had aListen 443
and I addedNameVirtualHost *:443
there. It also refers to some other file in the comments, but that didn't exist on my server. Run anapachectl -t
to check if your configuration is correct.