Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm using apache webserver on ubuntu base o/s. I want to change the web-server hostname to lets says

The virtual machine that runs the web-server is stand-alone machine not part of domain as my host machine which is windows 7. I want to know if by editing etc/hosts to


Would allow the users to access my web-server by dns? Like

OR i need to make some changes into the apache configuration files too.


share|improve this question
Let me get this straight: you do own the domain name – January Oct 11 '12 at 17:21

1 Answer 1

I'm pretty sure you need one more thing, which is to make an entry in the apache virtual hosts configuration file. It's pretty easy to do, once you see how it's done.

Normally, you would edit the file /etc/apache2/sites-available/000-default, which is a link to the default file in "sites-available."

In this file, you can add any number of virtual hosts, which define a site and its directory. So, you would add an entry to the end of the file something like this:

<VirtualHost *:80>
    <Directory /var/www/whateverdirectory>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    DocumentRoot /var/www/whateverdirectory/

In my configuration file, I have the initial "VirtualHost" definition set to the root /var/www, so I can access things that are not defined in the configuration file, like phpmyadmin (which could be defined, but isn't right now), etc. I have a static index page there saying something more useful than "It works!".

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.