Questions regarding hostname, hosts file and FQDN

Hello:

I have a linode and was going through the Getting Started Guide.
It mentioned to change the hostname to something meaningful.

Currently my linode hosts about 30 sites.
www.site1.com to www.site30.com

and i usually call my machine - vlprod1

  1. so my question is should i keep the hostname
    vlprod1 ? Is that a valid hostname for internal purposes ?

  2. if my hostname is vlprod1 what will my entry in /etc/hosts look like ?

123.123.1.123 vlprod1 vlprod1

since i don't have an A or AAAA record for vlprod1 can I add this to /etc/hosts ? (this would mean FQDN is same as hostname i.e vlprod1)

Thanks in advance.

Yashesh

1 Reply

Linode Staff

Hi there Yashesh,

This is a great question, and it can definitely get a little confusing keeping all the hostnames, virtual hosts and FQDNs straight. So let's start at the top.

should i keep the hostname vlprod1 ? Is that a valid hostname for internal purposes ?

You can totally keep the hostname vlprod1. It is 100 percent valid for internal purposes. The listings in that file are for your server's internal usage, and do not have to be public facing. There are a lot of things that you can do in the /etc/hosts file, and many different ways you can set it. For some more information and background I would recommend taking a look at this document.

if my hostname is vlprod1 what will my entry in /etc/hosts look like?

If your hostname is vlprod1 it is going to have to be included in your FQDN. In this case, the formatting we're looking for is going to be IP, Hostname, Domain Name, Hostname.

123.123.1.123 vlprod1.site1.com vlprod1 


The above is the FQDN of your Linode.

since i don't have an A or AAAA record for vlprod1 can I add this to /etc/hosts ?

In this case, you aren't going to need an A or AAAA for the specific hostname. You are going to need an A or AAAA record for the IP address of the Linode. In your DNS configuration this is going to look like a blank space. For more information on setting FQDN, I have found this post to be extremely helpful.

Finally, in your specific use case of wanting to serve many different websites from a single Linode, it is good to remember that this configuration is going to be through the Virtual Hosts file of your particular server application. (ie Apache or Nginx)

In that regard we have useful documentation explaining the setup of a virtual hosts file in both Nginx and Apache.

I hope this lets you hit the ground running!

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