Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I bought a VPS a few days back and had a domain name registered. It gave me 2 nameservers.

I only have shell access (no Cpanel/WHM) and it's running CentOS 5. I can visit my site with http://IP/ but not with http://domain.com. What changes do I need to make so that I can visit my site with http://domain.com. I'm really new at this and any help would be greatly appreciated. Thanks.

share|improve this question

2 Answers 2

You need to make sure that your domain name is using your two nameservers. You can do this by using a whois command (whois example.com) or using any number of websites (eg. http://whois.domaintools.com/example.com).

Then if your domain name is using the correct nameservers, you need to configure those nameservers to return your ip address for your domain. How you do that will depend on what software the nameservers are running and what access you have to them. You need to get them returning at least an A record for your domain name pointing to your ip address (example.com IN A

If your domain name isn't using the correct nameservers then you need to configure that at the place you registered your domain name.

Finally you'll need to configure your server to respond correctly to the domain name. This will involve setting up Apache (or whatever other web server you are running) to listen to requests for your domain. If you're only hosting one domain then you can get away with just using the default site, with your pages stored in /var/www. Otherwise you'll need to configure virtual hosts.

Then of course there's email too. Ubuntu systems have nice setup scripts for the default mail server to let you configure at least the basics. I don't know about Centos.

share|improve this answer
Hi, thanks for the detailed response. whois returns the correct name servers that were given to me. One of them is the same as my VPSs IP. So that means I'll just have to configure my VPS? Doing a 'dig domain.com' gives ;; QUESTION SECTION: ;domain.com. IN A I have my pages in var/www/ and running Apache. I'm not sure what to do from here. –  user41010 Apr 20 '10 at 18:36
OK, so you need to configure your nameserver which is easier and less scary than you'd think. See linuxgravity.com/… for a start in configuring Bind on Centos. –  kaerast Apr 20 '10 at 21:40

First you need to make sure that your domain name correctly resolves to the correct ip-address. Does something like "ping domain.com" show that you are connecting with the correct ip-address?

share|improve this answer
Nope, I just tried it. It says "Ping request could not find host..." I'm running 'named', I guess that needs to be configured somehow? Thanks. –  user41010 Apr 20 '10 at 9:49
If you are on a linux system, does the command "dig domain.com" return the correct ip-address? What if you use "dig @givennameserver domain.com"? Normally, if you buy a VPS and register the domain name at the same company, they will add your domain name on their own DNS servers, and I guess that they gave you the ip-addresses of their own nameservers. With the dig command, you can specifically query your domain name on their name servers. –  rubenvdg Apr 20 '10 at 10:05
Thanks. Doesn't seem to make much sense with "dig domain.com": ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0 It's from the shell of the VPS. Querying for dig @ns1.domain.com domain.com returns dig: couldn't get address for 'ns1.domain.com': failure. I don't have access to ns2.domain.com but the ns1.domain.com is the same as my VPS. –  user41010 Apr 20 '10 at 18:45
Ok... then you'll need to configure your own nameserver, like kaerast mentioned. –  rubenvdg Apr 21 '10 at 8:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.