Setup Nameserver for an Apache Webserver
Configuring DNS :
I have no idea of how to do that through godaddy's interface but here is what you need :
You have delegated the hosting of your DNS zone "example.com" to GoDaddy. So they are the one managing what's in the zone.
Now, for your server to be callable by its name, you have to make GoDaddy add a "A Record" to your zone, mapping www.example.com
to your IP (say 12.13.14.15
). You may want to consult wikipedia about how the DNS protocol really works.
Once your DNS zone is set, it's also better to modify your server-side configuration :
Set your server name in /etc/hosts
:
127.0.0.1 localhost localhost.localdomain 12.13.14.15 www www.example.com
This will allow your host to resolve itself quicker than if it has to make a DNS query...
Modify your system name :
(if the web server is its only service otherwise another system could be better)
hostname www.example.com
Make apache aware of its name
In your apache-httpd configuration, (inside VirtualHosts if you use them) add this directive :
ServerName "www.example.com"
My explanation could be more plateform/distribution independent and/or more detailled, so if anyone wants to suggest additions/modifications, don't hesitate.
Related videos on Youtube
Jo E.
Updated on September 18, 2022Comments
-
Jo E. over 1 year
(does the title make sense? cause I'm not sure)
I want to host my own site. I've setup an
Apache Server
and I am able to call the site viaIP
. Now I want to call it via adomain
.I have an extra domain from GoDaddy, normally to use those domains I change the
Nameserver
to the ones my Hosting is providing e.g.ns1.example.com
andns2.example.com
, how do I setup thens1.example.com
andns2.example.com
on my webserver so that I can use it on my GoDaddy account?Sorry if this is noobish I'm new to this server stuff.
Appreciate the help! Thanks!
-
mveroone over 10 yearsDo you want to be able to resolve name from your web applications, or to access you web application by it's name instead of IP ?
-
Jo E. over 10 years@Kwaio access my web applications by its domain name instead of IP.
-
mveroone over 10 yearsI'm not familiar with godaddy and its interface, but what you need to do is to configure for example
www.example.com
to your IP address on their DNS Zone configuration page. There's nothing else to do server-side, but maybe change /etc/hosts sowww.example.com
resolves to your server and addServerName www.example.com
to your apache (virtualhost) configuration -
Jo E. over 10 yearsWhen their interface asks for the nameserver I type-in my IP(e.g. 1.1.1.1) and click ok. It then returns that what I typed-in is an invalid Nameserver and TLD error. I tried searching for that TLD error and majority of my finds say that its due to an
Invalid Nameserver
. Any ideas? -
mveroone over 10 yearsYou have to use their nameservers, and edit the Zone to add a "A" field mapping
1.1.1.1
towww.example.com
help.wildapricot.com/display/DOC/Godaddy+DNS+Setup+example -
Jo E. over 10 years@Kwaio so I point the
A
record from their IP to mine? And that's it? Well I can't know right now because it needs to propagate. . I'll comment when I get results. Thanks for the help! -
user over 10 years@Kwaio You should post that as a proper answer so you can get at least the accept :)
-