Problem
I was trying to create a virtual host on Apache 2.2, running on Ubuntu 11.04 (Natty Narwhal). I was doing so using archives, including a virtual hosts file, from an older Ubuntu 8.04 server. While both servers ran Apache 2.2, the newer server runs 2.2.17, while the older one ran an earlier version (it’s been decommissioned, so I can’t easily check, but it was probably 2.2.8).
I copied the virtual host file for the new site into /etc/apache2/sites-available, created a simlink in /etc/apache2/sites-enabled and restarted Apache. I got the following error:
[Wed Jul 25 16:38:50 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
Solution
After a little Googling, I found the solution in the second comment from Ken on Von Welch’s posting NameVirtualHost *:80 has no VirtualHosts.
My virtual host file had <VirtualHost *>
as the first line. Per the comment, I changed it to <VirtualHost *:80>
, restarted Apache, and it worked.