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'm using apache webserver on ubuntu base o/s. I want to change the web-server hostname to lets says xyz.compnayname.com.uk.

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

 ipaddress          xyz.companyname.com.uk

Would allow the users to access my web-server by dns? Like http://xyz.companyname.com.uk/whateverfile.

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

Thanks

share|improve this question
    
Let me get this straight: you do own the domain name companyname.com.uk? –  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
    </Directory>
    DocumentRoot /var/www/whateverdirectory/
    ServerName xyz.companyname.com.uk
</VirtualHost>

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

 
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.