You're specifying the name of the server, literally. Pick the one that you want your server to be, it's up to you.
It will be the default name for any services you run on the server unless you specify otherwise. For example, this is often going to be the default host to remotely connect to the server to such as with SSH. Nevertheless, many other protocols will be specified to utilize hostnames outside of your server's hostname. For example, rarely will Apache's primary role be to serve files on the server's default hostname.
With Debian, /etc/hostname is read by the /etc/init.d/hostname.sh init script and will reflect any changes upon reboot. To change dynamically without reboot, you can also run the command hostname $NEWHOSTNAME.
You can call your server as you want, this doesn't need to have any relationship to the services or web sites it's hosting. This is particularly true if it's hosting multiple web sites.
/etc/hostname should be configured with the real name of your box (i.e. which is also configured as forward and reverse name/IP in DNS). Same counts for /etc/hosts and /etc/resolv.conf
E.g. if your server has the IP address 203.0.113.2, 2001:db8:34::56 and the name pietje.example.com, put this in /etc/hostname:
Note that the first name (after the address) should be the fully qualified domain name (fqdn), any other names, including your hostname without a domain, should follow. This is because hostname --fqdn will return the first name on the line, and it should be the one that resolves externally.
and this on the first line in resolv.conf:
domain example.com
(On most systems, you don't have control over this; it is filled with information from the DHCP server. But that's ok, this domain is only used for when you look up a host without specifying a domain; it doesn't mean this domain is valid for your host.)
You're specifying the name of the server, literally. Pick the one that you want your server to be, it's up to you.
It will be the default name for any services you run on the server unless you specify otherwise. For example, this is often going to be the default host to remotely connect to the server to such as with SSH. Nevertheless, many other protocols will be specified to utilize hostnames outside of your server's hostname. For example, rarely will Apache's primary role be to serve files on the server's default hostname.
With Debian,
/etc/hostname
is read by the/etc/init.d/hostname.sh
init script and will reflect any changes upon reboot. To change dynamically without reboot, you can also run the commandhostname $NEWHOSTNAME
.You can call your server as you want, this doesn't need to have any relationship to the services or web sites it's hosting. This is particularly true if it's hosting multiple web sites.
/etc/hostname
should be configured with the real name of your box (i.e. which is also configured as forward and reverse name/IP in DNS). Same counts for/etc/hosts
and/etc/resolv.conf
E.g. if your server has the IP address
203.0.113.2
,2001:db8:34::56
and the namepietje.example.com
, put this in/etc/hostname
:this in
/etc/hosts
:Note that the first name (after the address) should be the fully qualified domain name (fqdn), any other names, including your hostname without a domain, should follow. This is because
hostname --fqdn
will return the first name on the line, and it should be the one that resolves externally.and this on the first line in
resolv.conf
:(On most systems, you don't have control over this; it is filled with information from the DHCP server. But that's ok, this domain is only used for when you look up a host without specifying a domain; it doesn't mean this domain is valid for your host.)