NameVirtualHost *:80 has no VirtualHosts

Jay picture Jay · Aug 23, 2011 · Viewed 77k times · Source

I have two domain names, two ssl certs and two ip addresses. I am trying to configure my apache virtualhost files for them.

First, i commented out all instances of "NameVirtualHost" and "Listen" for ports 80 and 443. Then i did the following with my virtual hosts files.

VirtualHost file for domain1:

NameVirtualHost 1.1.1.1:80
Listen 1.1.1.1:80
Listen 1.1.1.1:443
<VirtualHost 1.1.1.1:80>
    ServerName domain1.com
    ...
</VirtualHost>
<VirtualHost 1.1.1.1:443>
    ...
</VirtualHost>

VirtualHost file for domain2:

NameVirtualHost 2.2.2.2:80
Listen 2.2.2.2:80
Listen 2.2.2.2:443
<VirtualHost 2.2.2.2:80>
    ServerName domain2.com
    ...
</VirtualHost>
<VirtualHost 2.2.2.2:443>
    ...
</VirtualHost>

Answer

Randy Skretka picture Randy Skretka · Jan 8, 2012

I had ignored the same error for the 2 months I have had an Ubuntu server. I found this post nicely solved the error. Thank you Michael!. As did you Jay, I found the culprit at /etc/apache2/ports.conf . I tried simply this:

# NameVirtualHost *:80
I only commented out that line and no other changes and no more

"NameVirtualHost *:80 has no VirtualHosts"