VirtualHost Overlap on Port 80, or Port 443
By webchalk
Solution
When you install Apache in a development environment and in most production environments it works out of the box (so long as you understand the basic configuration). However sometimes things can go wrong, and here's a solution to help you overcome VirtualHost Overlap on Port Errors.
If you're getting a warning like:
[warn] _default_ virtualhost overlap on port 80, the first has precedence
When you start Apache, then all you need to do is add the following line to your Apache configuration file (usually httpd.conf)
NameVirtualHost *:80
What this does is allows name based virtual hosts and will accept any connections on port 80 unless a VirtualHost directive overrides the value further down in the configuration.
It's a problem that trips up a lot of developers, luckily it's an easy fix :)
In contrast if you're getting an error like this one:
[warn] _default_ virtualhost overlap on port 443, the first has precedence
It's likely that you've tried to setup some virtual hosts to run over SSL, and you need to include the matching directive to allow name based virtual hosts over that port:
NameVirtualHost *:443
I got these tips from the blog at antbrown.com, read more about virtualhost overlap on port.
Comments
I should add that on Ubuntu 10.04 there is a ports.conf file at
/etc/apache2/ports.conf
just add the directive:
NameVirtualHost *:443
hello
This is default in apache configuration;i not arrive to configure apache well
default_ VirtualHost overlap on port 443, the first has precedence
hello
This is default in apache configuration;i not arrive to configure apache well
default_ VirtualHost overlap on port 443, the first has precedence
Thanks a lot. It works for me
No go on Ubuntu 10.04 LTS
It simply reads the Root of the web directory when specifying https
on ispconfgi3 with debian
The httpd.conf was empty, I add NameVirtualHost *:80
I now have 3 warnings (instead of 2 before) when I restart apache2 :
[warn] NameVirtualHost *:80 has no VirtualHosts
[warn] NameVirtualHost X.X.X.X:443 has no VirtualHosts
[warn] NameVirtualHost *:80 has no VirtualHosts
But it now works ! I can access two separate website (from two different domain name)
Thanks !
s 6 months ago
Thanks, nice and concise