I'm having a few problems when setting up IP-based virtual hosts. First of all I'm using the current XAMPP from apachefriends (XAMPP 1.7.7 with Apache 2.2.21) on Windows 7.

The basic functionality over the "main" server (from httpd.conf) works perfect. But now I want to set up multiple vhosts with different IP-addresses, as I configured my network card to use all IP-addressess from to .

This is the virtual hosts entry:

    DocumentRoot "/xampp/hegedocs/www"

httpd -D DUMP_VHOSTS says this:

PS G:\xampp\apache\bin> ./httpd -D DUMP_VHOSTS
VirtualHost configuration: (G:/xampp/apache/conf/extra/httpd-vhosts.conf:45)
Syntax OK

But I am unable to access the vhost neither seems apache to listen on - there is no entry shown for this address with netstat -a -b.

  • Did you restart the service after making the config change? Have you verified that the process is listening on that port? – Shane Madden Nov 21 '11 at 5:48

I found the problem: IP based vhosts just don't work. Just defining a few names in the hosts file (foo.localhost, bar.localhost all mapping to the same IP address) and then using name based vhosts works without any problem. Of course this is not as portable as IP-addresses as other machines in the network naturally don't know these names... but well, as long as it somehow works...


Just check this guide


It's working for me


Here are some basic things you could try adding, to make sure you're getting the right port.

# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

Here is an example from appache on what it should look like:

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com

# Other directives here


<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example2.org

# Other directives here


I'm sure you have seen this before, but sometimes it helps to look back at the simple stuff.

My setup works fine running 2 websites on 1 box, using ServerName www.example.com.

Hope this helps!

  • Well that did not worked for me. As far as I see all values are correct. Maybe you can spot the error? I uploaded both the httpd.conf and the httpd-vhosts.conf: pastebin.com/HrPE0gJy – dom0 Nov 20 '11 at 19:19
  • ServerName localhost:80 I'm not sure if the IP is local host, but maybe add the IP there in the httpd.conf . – Tillman32 Nov 21 '11 at 5:42
  • 1
    I'm now using name based virtual hosts. That works at last ;) – dom0 Nov 21 '11 at 14:00

Make sure that apache knows where the vhost.conf file is. At the bottom of httpd.conf, you may have to uncomment

Include conf/*.conf
  • Well DUMP_VHOSTS tells me that apache knows about the vhost... syntax is ok, too. I guess it is some kind of apache <-> OS interaction problem... – dom0 Nov 20 '11 at 22:55

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.