If my domain is example.com
, what should I put as hostname in my VPS setup using Debian 8.7 Jessie? Is it www.example.com
or example.com
or example
?

- 4,335
- 4
- 34
- 71

- 71
- 1
- 1
- 2
-
1There are some good arguments not to use the bare domain for your websites : https://serverfault.com/q/842842/37681 - but in general the hostname has very little bearing on the names used in the services you offer – HBruijn Apr 28 '17 at 21:45
4 Answers
Like EEAA said, you can put in basically whatever you want.
That said, I do recommend having some kind of naming strategy for your hosts. Even if you only have a single VPS currently, it's not at all unheard of to grow systems horizontally over time, or to split services that were once co-located on a single server onto different servers.
Such a naming scheme can be as fancy or as boring as you like. You could use for example names of games (soccer
, chess
, ...), astronomical objects (proxima-centauri
, saturn
, ...), cities, species of animal, or just technical names that directly reflect the function of the particular host (such as ns2
or mail1
). If the people you work for lack humor, I recommend purely technical names, or even a simple sequential scheme (to my knowledge, nobody ever got fired for naming a system server04
).
I also strongly suggest putting the names under a domain name under your control. It's not actually a requirement, but doing so will save you from many headaches in the future. Then add whatever names you come up with to that domain name in DNS.
So if you have registered example.com
then you might put in luna.example.com
or chess.example.com
or whatever else strikes your fancy.
You should strive to pick names that are unlikely to conflict with any public names you might reasonably want to use in the future which aren't guaranteed to be served by this particular host for as long as this particular host exists.
You can then configure the software running on that host to serve content for any host name of your choosing, and publish any host name of your choosing. Just because the physical (or in this case, virtual) host is known by an astronomical name doesn't mean you can't serve www.example.com
off it.

- 4,335
- 4
- 34
- 71
Put whatever you want. The hostname of the server has nothing to do with what the names are of the services you'll be hosting on the server.

- 109,363
- 18
- 175
- 245
I guess the information in the screenshot is helpful to decide about the hostname.
You should choose something that will be socially acceptable, as it will appear in all mail headers. A hostname should consist of a name and a domain name. All valid hostnames should have 2 dots in them.

- 111
- 2
As said, you can use almost anything. Some choices make things harder down the road (like mail), so before you go installing all sorts of services and things that read the hostname and write it into the default config you want to set something sensible that tells you what machine you are on or what the purpose of the machine is.
My personal practice is to use what VPS number it is (I have 3 or 4 going at any one time so vps01 or vps03) or if it is a VM in virtualbox on my own machine I'll use its purpose (dns-experiment or whatever).
For mail servers (I use postfix+dovecot w/ mysql on Debian) I never use the host-name-part of the fqdn that will be used as the mailname (/etc/mailname and in postfix's myhostname in main.cf).
And of course, don't forget to update /etc/hosts !

- 1,488
- 7
- 6