-1

If i want to name my server..

 x.domain.tld

why must i edit 2 files in order to accomplish this.

the two files being:

/etc/sysconfig/network
/etc/hosts

also does the servername or hostname..
do i need to create an A record for it with my DNS company ?

because while the server is not complaining about

x.domain.tld

the truth is.. i have not created an A record for

x.domain.tld

with my DNS company.

or perhaps it is a CNAME record and not an A record ?

but ultimately the question is.

do i even have to create an A record or a CNAME record for the hostname that i use in

/etc/sysconfig/network
/etc/hosts

?

because by default.. although

 x.domain.tld

is the hostname in

/etc/sysconfig/network
/etc/hosts

unless i create an A record or a CNAME record with my DNS provider..

  x.domain.tld

will never resolve on the internet.

and yet..

the server itself seems to be resolving it just fine and not complaining about it

i think it actually complains only if i do not have a

 VirtualHost

entry in the

 httpd.conf

file

for the

 domain.tld

although the hostname in the

/etc/sysconfig/network
/etc/hosts

is a

x.domain.tld

1 Answers1

0

The hostname is more of a useful identifier of your server. ( https://serverfault.com/questions/228102/hostnames-what-are-they-all-about )

You do not need to register the domain name you use as a hostname unless you intend the domain to be accessible to the world.

The reason you have to edit hosts is because, as you pointed out, the domain is not registered and there is no DNS entry for it. The hosts file acts like a local DNS cache. So you OS looks to the hosts file first while trying to resolve the domain. ( http://en.wikipedia.org/wiki/Hosts_(file) )

The virtualhost entry in your httpd.conf file is for apache to recognize the "host" that a request was destined for and route it to the appropriate file structure on disk.

If you setup a VirtualHost entry for a domain that was un-resolvable it would not work and you would get a domain name cannot be resolved. (this is what the hosts file entry fixes for domains who are not registered and have DNS entries.)

I hope that helps :)

Community
  • 1
  • 1
IrishGeek82
  • 355
  • 2
  • 8