/etc/hostname and /etc/hosts

Posted June 3, 2015 4.4k views
Linux BasicsDebianNetworkingDNS

When I set up a droplet I was “lazy” with naming. Now my hostname is “”. And there are two websites on the server (NGINX).

I want to change hostname from “” to Production. But I am slightly lost since two FQDN are pointing to the same machine.

Should I do as following:

change in /etc/hostname to Production (as from now it was
(* this one for me is logical *)

change in /etc/hosts: SITEA.COM SITEB.COM
(now it was

I am especially lost by this loop-back.

Or should I do:
(real-ip) SITEA.COM
(real-ip) SITEB.COM

Or should I just Production


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

If u said your server in nginx web server. Its better you set your domain to DO nameserver and pointing domain to A - “ip address” and setup your nginx config with different domain.