Questions regarding hostname, hosts file and FQDN
I have a linode and was going through the Getting Started Guide.
It mentioned to change the hostname to something meaningful.
and i usually call my machine - vlprod1
so my question is should i keep the hostname
vlprod1 ? Is that a valid hostname for internal purposes ?
if my hostname is vlprod1 what will my entry in /etc/hosts look like ?
18.104.22.168 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.
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.
22.214.171.124 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)
I hope this lets you hit the ground running!