If on CentOS 7:
Code:
hostnamcectl set-hostname servix.example.com --static
If on CentOS 6, use the `hostname` command like you just demonstrated. The `hostname` command will still work on CentOS 7, but with the introduction of systemd, the recommendation is to use hostnamectl going forward.
Quote:
I am guessing in /etc/hosts
127.0.0.1 localhost
66.19.240.12 or is it 192.168.1.4 servix.example.com servix
|
I'm assuming you're using a NAT or PAT (IP address or port translation through a router or firewall), since you provided both a public and a private IP address. If you are using a NAT or PAT, it's usually better to use the private IP address:
Code:
127.0.0.1 localhost
192.168.1.4 servix.example.com servix
Keep in mind this is situational. You may find that with your application, it's better to use the public IP address. The only difference this makes is how the server resolves its own host name.
EDIT: Forgot to answer your final question...
Quote:
and in FreeDns A Record should point to 66.19.240.12 both example.com and www?
|
I'm a bit confused about what you're trying to make resolve. In the example you provided, servix was your host name.
In the simplest cases, you have '@' (no subdomain) and 'www' resolve to the same IP address. So yes, you probably want example.com and
www.example.com to resolve to 66.19.240.12.
If you also want servix.example.com to load something from your server, it will also need to resolve to 66.19.240.12.