Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have defined 2 Virtual Hosts in Apache:

Site1:

<VirtualHost *:8080>

    ServerAdmin emt@gmail.com
    ServerName site1.mydomain.com

    DocumentRoot /var/www/site1/www

</VirtualHost>

Site2:

<VirtualHost *:8080>

    ServerAdmin emt@gmail.com
    ServerName site2.mydomain.com

    DocumentRoot /var/www/site2/www

</VirtualHost>

After enabling them, I try to restart apache and I get this error:

* Restarting web server apache2
[Fri Feb 14 17:06:15 2014] [warn] _default_ VirtualHost overlap on port 8080,
the first has precedence
 ... waiting .
[Fri Feb 14 17:06:17 2014] [warn] _default_ VirtualHost overlap on port 8080,
the first has precedence

I thought that as long as I had the directives ServerName with different domains, I could have several sites in my Apache installation. Did I miss anything?

share|improve this question

closed as off-topic by Chris S Feb 14 at 22:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Chris S
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Please at least glance at the official documentation before asking questions that are answered in the first few paragraphs under "Name-based Virtual Host Support". –  Chris S Feb 14 at 22:23

1 Answer 1

up vote 4 down vote accepted

You also need NameVirtualHost *:8080

See http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

share|improve this answer
    
Now the URLs are working, but when I restart Apache2, I get this warning: NameVirtualHost *:8080 has no VirtualHosts. Why is that? Can I get rid of it? –  Dbugger Feb 14 at 22:21
    
@Dbugger: read the documentation on Listen and <VirtualHost> –  Iain Feb 14 at 22:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.