Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have around 130 IPs on my linux server. 125 IPs point to one site, and 5 of them point to another. I would like to make just two virtualhost definitions.

Currently I am doing a wildcard at the top, and then separate Vhosts for each of the 5 IPs..The problem that I run into is sometimes it will trigger to pickup the wildcard (*) vhost when it can't find anything on the other 5.

share|improve this question
up vote 1 down vote accepted

I don't think there will be any pretty or elegant way to do this with all those IP's but it looks like this may be your best bet:

It looks like you can space separate IP in the VirtualHost declaration

<VirtualHost 3.other.IPs>
    DocumentRoot /www/example1

Then just use the default setup to take in the other 125 ips

<VirtualHost _default_:80>
    DocumentRoot /www/example2

Hope this helps!

share|improve this answer

You should be able to define a default virtual host for the 125 IP pointing to the one site as follows

<VirtualHost _default_:80>

and then one virtual host for every one of the 5 'special' IPs.

share|improve this answer
I do that now... – user36644 Mar 3 '10 at 19:18
Are you doing a wildcard (VirtualHost *) or the default one I suggested ? – Dominik Mar 3 '10 at 19:26
I do a * but I need to do two of them so I cant use it twice. – user36644 Mar 3 '10 at 22:35

You could write scripts to generate per-ip vhost.

share|improve this answer
There is no exceptions that can be made? Or any kind of range – user36644 Mar 3 '10 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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