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've been battling to get a vhost config working on an internal development server at work. I have found other vhost configs in the site-available directory. For some reason, I can't see why my new vhost is not responding to any requests. All i get is a 404 statement. This is not a publicly access server so I'm not sure if that has anything to do with this. Also if I purposely add a syntactic error in my config.. apache yells at me so I know it actually being loaded. I have restarted the apache server multiple times. I don't know if it has to do with the servername at all. I just want to type in and have apache drop me in the DocumentRoot i have chosen. Currently i can do 192.168..254.35/rack_example/public.

  • Where else should I be editing to make this work?

This is what I am trying to load

<VirtualHost *>
    ServerName rackapp

    DocumentRoot /var/www/rack_example/

This config works without problem

<VirtualHost *>
    ServerName collab

    DocumentRoot /var/www/collab/

    ErrorLog /var/log/apache2/colab-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/collab-access.log combined

share|improve this question

Apache uses the hostname you type in your browser to select the right virtual host. If you use the IP address, it will pick the first virtual host available.

To test your virtual hosts, you should access them by their name. For this you can edit the hosts file /etc/hosts and add those two lines: rackapp collab

%SystemRoot%\system32\drivers\etc\hosts for Windows systems.

Then you'll be able to access http://rackapp/ or http://collab/ and test your Apache configuration.

You can also play a bit and directly send the HTTP header to your Web server:

$ echo -e "GET / HTTP/1.1\r\nHost: rackapp\r\n\r\n" | nc 80
share|improve this answer
Still confused sorry..I'd like to use as the url for a specific application on this box.. I don't want to change how the box is accessed just rather this one application or subdirectory. – user2108258 Apr 17 '13 at 19:49

You're confusing servername and URL here.

If you want to have be the URL for the server, then the ServerName of the VirtualHost should be instead of rackapp. With the setup you've got, you need to connect to the server using http://rackapp instead, and that will give you the document root you've set up for the virtualhost.

If trying to connect to http://rackapp gives you "Server not found", then you need to edit your /etc/hosts file to contain the line rackapp
share|improve this answer
Thanks JD for your response. Will this work with other applications on the same box.. This box has other applications in /var/www .. I'd like to access an application on this box by writing Excuse my ignorance on the subject – user2108258 Apr 17 '13 at 19:41

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.