Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 can't get my apache configuration to open my index.html
I edited my /etc/apache2/apache2.conf and added the following at the bottom.

<VirtualHost *:80>
DocumentRoot /media//DATA/directory/to/my/index-file/

Then I restarted my system. But, when I open localhost I get the:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

How to get localhost, with a different directory to my index, working in Ubuntu 12.10(amd64)?

share|improve this question
up vote 1 down vote accepted

If you want to access the data via the name localhost, change the ServerName directive from to localhost.

You can also set wildcards for the server name, to deliver the files under several names.

You should consider reading the Apache Documentation section regarding Virtual Hosts.

More important: take a look at the directory /etc/apache2/sites-enabled and /etc/apache2/sites-available. This is where your site configurations should go for easy maintenance, not in the main apache2.conf file. Your VHost definition might even interfere with the default host definition. You can run sudo a2dissite default to disable the demo site.

share|improve this answer
Thanks! I'll try this when i get home. BTW my index is located in an external partition(NTFS) should that be a problem? – blade19899 Oct 29 '12 at 8:12
as long as the web server (user www-data) has read permissions this will not be a problem. In any case you will notice if this should become the stopper. – Paul Hänsch Oct 29 '12 at 11:19
It worked changing the to localhost thanks! – blade19899 Oct 29 '12 at 17:30

I think you are trying to set up additional root addresses apart from "localhost". This needs a little more work.

This tutorial is a little old but should work on 12.10

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.