Re Update hosts file and FQDN

Complete newbie and working my way through the "Getting Started" guide. Searched documentation and forum. Please help.

Need to understand the step at "Update etc/hosts"

Distribution: Ubuntu 10.04 LTS

My Linode will host 3 websites. The registered domains will point to Linode's DNS

Q 1: Must there be an entry in the hosts file for each of the domains, for example:

127.0.0.1 localhost.localdomain localhost

xx.xx.xx.xx myhostname.domain1.com myhostname

xx.xx.xx.xx myhostname.domain2.com myhostname

xx.xx.xx.xx myhostname.domain3.com myhostname

Q2: Or do I only have to enter a single FQDN in the hosts file? If so, am I correct to assume the domain must be registered and pointing to Linode DNS? Would one of the 3 domains be able to serve this purpose?

Thanks

3 Replies

Just choose one of your domains, create the A record for "myhostname.thatdomain.com" pointing to your node's IP and add the "xxx.xxx.xxx.xxx myhostname.thatdomain.com myhostname" line to /etc/hosts.

You don't need to be using Linode's DNS hosting service. All that matters is that the proper A record exists, at whatever DNS host you use.

Don't touch the hosts file unless you know what you're doing.

You already have a valid FQDN. It's "li-XX.YYY.members.linode.com". There's no reason to change it unless you want to customize your shell prompt or you need to keep track of multiple servers. Neither of these are urgent concerns if you're just starting with Linode.

In fact, for newbies, it's probably best to leave your hostname alone, because any error in this area will cause problems when you try to add Apache virtual hosts or send password reminder e-mails from your website. Too many people misconfigure hostnames and cause their e-mails to get sucked into a black hole. Trust me, you don't want to have that headache. Having your IP address hard-coded in the hosts file will also cause issues if you ever need to move datacenters.

Adding something to the hosts file won't magically make it a valid FQDN for hosting and e-mail purposes. All it does it to trick programs like Apache to think that they have an FQDN when in fact they don't, because the hosts file overrides the public DNS system. This is sometimes useful, but newbies find it too easy to abuse the hosts file to hide DNS problems instead of actually fixing them. So again, my advice is "Don't touch the hosts file."

As long as you use Linode's default hostname as your FQDN, you'll be fine. What you use as your FQDN has absolutely no effect on what domains you'll be able to host or what domains you'll be able to send e-mails from. It's a purely cosmetic choice. If you want to change the default, you should make up a proper subdomain in your DNS manager. You don't even need to add it to the hosts file if it has been properly set up in your DNS manager.

Thanks for the replies. I'll post again when done.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct