Fully Qualified Domain name on Ubuntu Server
I've setup a LAMP server on Ubuntu 10.04 (lucid) and have also installed Virtualmin. This is my first attempt at setting up a server of any sort.
I set up one virtual host using Virtualmin and so far so good. Some odd things are happening though, such as when I type in my primary domain into a browser, I see the contents of the virtual server instead of what should be in the default directory.
I'm going to use 123.345.789 and example.co.uk instead of my actual ip and domain name's if thats ok.
I checked my hostname by using
hostname -f
and got
production1
as my response
The contents of my /etc/hosts file is (ip's and domain changed to something generic for this post):
127.0.0.1 localhost localhost.localdomain
123.456.789 production1.example.co.uk
123.456.789 production1
shouldn't my FQD be production1.example.co.uk? How can I go about changing this?, a simple step by step instruction would be great! thanks in advance.
The /etc/hosts
file contains some last ditch effort at name resolution, but isn't the full story with what you're trying to do. Do the following and you should be good to go:
- Edit
/etc/hostname
such that it contains only 'production1.example.co.uk' - Run
hostname -F /etc/hostname
The hostname file contains your fqdn for system use, and the hostname command re-reads that file for the system. At this point you can restart your services and everything should work fine, worst case a reboot might be necessary.
Your hosts file has a mistake; You shouldn't list an IP on multiple rows.
127.0.0.1 localhost localhost.localdomain
123.456.789 production1.example.co.uk production1