Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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/
ServerName host-test.com
</VirtualHost>

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
add comment

2 Answers

up vote 1 down vote accepted

If you want to access the data via the name localhost, change the ServerName directive from host-test.com 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 host-test.com to localhost thanks! –  blade19899 Oct 29 '12 at 17:30
add comment

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 http://tuxtweaks.com/2009/07/how-to-configure-apache-linux/

share|improve this answer
add comment

Your Answer

 
discard

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.