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'm using XAMPP on Windows and I'm trying to set up a virtual site on 8080 port. I'm using the following conf:

Listen 80
Listen 8080

NameVirtualHost *:80
NameVirtualHost *:8080

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost

<VirtualHost *:8080>
    DocumentRoot "C:/xampp/htdocs/site2/"
    ServerName localhost

In site2 I have files...

site2/img/profile_pic.png and site2/icons/led/map.png

I can open the first one in my browser using the http://localhost:8080/img/profile_pic.png but the second one returns 404 when I try to open it (http://localhost:8080/icons/led/map.png)

The funny thing is that when I enter http://localhost:8080/icons it list the folder c:\xampp\apache\icons

Whats happening here?

share|improve this question
Do you have anything in the Apache logs? – Bill Weiss Feb 2 '11 at 22:31
up vote 0 down vote accepted

Search the httpd.conf config file, you will probably find a default directive defining a link to c:\xampp\apache\icons

share|improve this answer
I managed to figure it out on my own... but thanks man! :) – rusbi Feb 2 '11 at 21:53

Virtual hosting expects that you use the domain name in your request. For example:


is just going to try and serve up the default site.

You need to set servername to the domain name of the site. For example "" and "".

You should set your hosts file (for testing) to:

and then go to each site in your browser like so:

share|improve this answer
Also the point of virtual domains is to have more than one address on a single port. So is there any reason you are specifying port 8080 for the second domain as opposed to having both on 80? – Antonius Bloch Feb 2 '11 at 20:19
Are you sure about that? Because it works for /img/profile_pic.png but not for /icons/led/map.png... Why is it working for the first case then? – rusbi Feb 2 '11 at 20:21
I want to test my site from the root directory... I cant relocate xampp because I need phpAdmin. Also, I want it to be accessible from the internet... it all done on my computer... – rusbi Feb 2 '11 at 20:23
I'm think your config is partially working because you each site ends up being the default for it's respective port number. – Antonius Bloch Feb 2 '11 at 20:25

Anyways... I found the source of my problem... The configuration was correct, the problem was with an alias defined somewhere in the default configuration used to display icons for directory listings... The alias was for /icons/ the same directory I use... so, mistery solved :)

share|improve this answer

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.