I've seen many similar questions about hosting multiple vhosts, one per IP, but couldn't find one regarding multiple vhosts PER IP.

In short, I have a single Apache2 server that needs to host multiple SSL certs. I have two separate IPs on the box. I have three domains on IP(a), one with multiple sub-domains on IP(b), like so:

IP(a) - SSL(a)
 - https:://domain1
 - domain2
 - domain3

IP(b) - SSL(b)
 - https://sub1.domain4
 - https://sub2.domain4
 - https://sub3.domain4

As I recently added IP(b), my first step is to transition domain4 to that IP. In the vhost conf file for the sub1, sub2, sub3.domain entries, I switched <VirtualHost *:80> to <VirtualHost IP(b):80>. Restarting Apache, I get the following error:

[warn] VirtualHost overlaps with VirtualHost, the first has precedence, perhaps you need a NameVirtualHost directive

I have the following NameVirtualHost entries in my apache.conf:

NameVirtualHost *:80
NameVirtualHost *:443

Any pointers on the proper way to proceed? Thanks.


Per Shane's answer and others, I've changed the following in my config, but now having an issue serving IP(a):443 content:


Listen IP(a):80
Listen IP(b):80
<IfModule mod_ssl.c>
    Listen IP(a):443
    Listen IP(b):443


NameVirtualHost IP(a):80
NameVirtualHost IP(b):80
NameVirtualHost IP(a):443
NameVirtualHost IP(b):443

All non-SSL sites that I want served on IP(a) are now:

<VirtualHost IP(a):80>

All SSL sites on IP(a) are now:

<VirtualHost IP(a):443>

All non-SSL sites on IP(b) are now:

<VirtualHost IP(b):80>

All SSL sites on IP(b) are now:

<VirtualHost IP(b):443>

All sites on IP(a):80, IP(b):80 and IP(b):443 are being served correctly. Nothing on IP(a):443 is being served, and when starting Apache, I get the following warning:

[warn] _default_ VirtualHost overlap on port 443, the first has precedence

I've changed my default file to respond to IP(a):

<VirtualHost IP(a):80>

And changed my default-ssl file to respond to IP(a) as well:

<VirtualHost IP(a):443>

Anything clearly wrong with the above? I've tried changing the settings a number of different ways, but the above warning seems to always be generated.


Your NameVirtualHost directives must match exactly to your <VirtualHost> definitions.

So if you have:

  ServerName domain1
  ServerName domain2

...then NameVirtualHost *:80 doesn't apply, you need to use NameVirtualHost

  • Almost got it - this resolved the post 80 issues, but now having an issue on port 443 - I've edited my question above. – Paul Mennega Jan 15 '13 at 17:27
  • 1
    @PaulMennega Seems like a _default_ vhost config from somewhere else must have slipped in.. can you edit the output of apachectl -S into your question? – Shane Madden Jan 16 '13 at 1:07
  • That did it - had an old vhost config on the server that I didn't have locally when editing the configs... apachectl -S did the trick. Cheers! – Paul Mennega Jan 16 '13 at 3:16

You might want to check out these links:

http://de.wikipedia.org/wiki/Server_Name_Indication as an explanation



on how to configurate.

Hope this helps.

  • This is not applicable - we have two IP addresses and do not need SNI. – Paul Mennega Jan 15 '13 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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