Setting up Domains with a VPS

aeisn

New member
May 6, 2009
715
12
0
Not sure if this should be here or in hosting/domains, feel free to move it as needed.

I am having difficultly setting up domains/nameservers on my VPS.

Here is what I have tried so far. I edited /etc/resolv.conf to be

ns1.mysite.com IN A 00.11.22.33
ns2.mysite.com IN A 00.11.22.33

I edited the domains nameserver registration on NameCheap to ns1.mysite.com with the same ips listed above. I then switched the nameservers over to ns1.mysite.com.

As I understand it this is all I need to do to set it up. I have given it 24+ hours and the DNS still doesn't seem to be working. Any help would be great.
 


I'm just going to outline the process in general for NameCheap, then you can compare what you did or didn't do right.


  • Register the domain you will be using for your nameserver. It seems like specialty domain extensions like .info don't work, so make sure you use one of the big three (.com, .net, .org)
  • Go to 'Manage Domains'.
  • Click on your domain that you'll be using as your nameserver.
  • Click on 'Nameserver Registration' under 'Advanced Options'.
  • In the boxes enter your ip addresses, you typically have to have at least 2 (so ns1.yourdomian.tld, and ns2.yourdomain.tld).
  • Click 'Add Nameservers >>'.
  • You should eventually be able to click on 'Find All Nameservers' and it should show you the ones you just set. You'll know they are good to go when underneath the 'current ip' column it has a 'created : date'.
  • Go back to 'Manage Domains', click on the domain you want to point at your nameserver.
  • Click 'Transfer DNS to Webhost'.
  • Enter your nameservers in the boxes (ns1.yourdomain.tld, ns2.yourdomain.tld, etc...).
  • Click 'Save Changes'.
Your domain will now be pointed at the ip's you entered in for ns1, ns2, etc...

From there it really depends on your system, you could just use apache virtual hosts to handle the direction. Or in your case using the resolve.conf file you can read up on an example on how to set it up here : Quick HOWTO : Ch18 : Configuring DNS - Linux Home Networking
 
You probably did this already but just incase: Did you setup the actual hosting account for it already on your server/cpanel and let it know to catch the domain name/ip? Or did you literally just do the namecheap steps..? Could be a http vs no http/www setting somewhere too.
 
It could be what ncmedia is talking about. You set up the DNS on namecheap but you might have forgotten to add on the domains on your server/cpanel. Do that and have them redirect to a folder that will contain your websites files on the server.
 
Who is your actual hosting provider for the VPS and what server management software did it come with?

Also beyond the DNS, your webserver needs to know where a name-based site points to. For example I could point Domain1.com to my server via DNS, but that does no good if the webserver itself doesn't know where "Domain1.com" resides file-wise. Management software such as whm/cpanel handles this fully automatic especially if you simply point your nameservers to the VPS itself.
 
Not sure if this should be here or in hosting/domains, feel free to move it as needed.

I am having difficultly setting up domains/nameservers on my VPS.

Here is what I have tried so far. I edited /etc/resolv.conf to be

ns1.mysite.com IN A 00.11.22.33
ns2.mysite.com IN A 00.11.22.33

You're all kinds of confused.

- /etc/resolv.conf is where you put the DNS servers that a machine should use to resolve all domain names. could be considered the DNS *client* setting.
- zone files are the configuration files for a DNS *server* where you tell the server that's responsible for resolving a particular domain what the names should resolve to.
- you don't put zone file information in /etc/resolv.conf

If your problem is 'How do I configure a Linux server to resolve domain names', google that.
If your problem is 'How do I make my domain name foo.com that's registered with namecheap resolve to 1.2.3.4', then just used namecheap's free DNS tool to do that.
If your problem is 'How do I make the existing NameServer machines ns1.foo.com responsible for the domain bar.com', then you need to go to the registrar for bar.com and input the name servers, *and* you need to make sure that ns1.foo.com is aware of bar.com.

Currently I'm not running my own DNS servers anywhere, and I'm using namecheaps, which are free. This does everything I need it to - unless you have some very particular requirements for automating different IPs for subdomains or something, I'd suggest you do that too.

m
 
Last edited:
First thanks for all the replies everyone.

You're all kinds of confused.

- /etc/resolv.conf is where you put the DNS servers that a machine should use to resolve all domain names. could be considered the DNS *client* setting.
- zone files are the configuration files for a DNS *server* where you tell the server that's responsible for resolving a particular domain what the names should resolve to.
- you don't put zone file information in /etc/resolv.conf

If your problem is 'How do I configure a Linux server to resolve domain names', google that.
If your problem is 'How do I make my domain name foo.com that's registered with namecheap resolve to 1.2.3.4', then just used namecheap's free DNS tool to do that.
If your problem is 'How do I make the existing NameServer machines ns1.foo.com responsible for the domain bar.com', then you need to go to the registrar for bar.com and input the name servers, *and* you need to make sure that ns1.foo.com is aware of bar.com.

Currently I'm not running my own DNS servers anywhere, and I'm using namecheaps, which are free. This does everything I need it to - unless you have some very particular requirements for automating different IPs for subdomains or something, I'd suggest you do that too.

m

Okay, so all the zone configuration files are in /var/named/ correct? I tried just copy pasting

ns1.example.com. IN A 00.11.22.33
ns2.example.com. IN A 00.11.22.33

to the bottom of localdomain.zone and localhost.zone to no avail. I feel like there is probably more to it though.

I have also edited /etc/httpd/conf/httpd.conf to be

Code:
<VirtualHost 00.11.22.33:80>
  ServerAdmin myemail@example.com
  DocumentRoot /home/usrname/public_html
  ServerName example.com
  ServerAlias www.example.com
  ScriptAlias /cgi-bin/ /home/usrname/public_html/cgi-bin/
</VirtualHost>\

As I understand it that's all I need to do to get this shit set up. Should I just be leaving /etc/resolv.conf blank? I really apologize if I am asking a shit load of stupid questions, I have googled to the best of my ability to get to this relative level of ignorance.
 
First thanks for all the replies everyone.



Okay, so all the zone configuration files are in /var/named/ correct? I tried just copy pasting
...


Can you please answer some of the original questions as it would probably help in getting you an accurate answer.

1) Who is your VPS's hosting provider.
2) When you ordered, what software/OS did you get with it.
3) Did Cpanel/whm/Plesk come with it?
4) Are you trying to point a domain to an IP
4a) If so, did you already get the domain working to the point you could add that domain in your own hosts file and it would popup on your own computer?
4b) If not, what are you trying to do exactly?

Thing is though, if you're using BIND (named) then you wouldn't be pointing to a different server for your server's DNS resolving, but rather be having an off-location DNS server handling the resolving (in which case BIND wouldn't even be used).

So please explain your setup in better details, as there's all kinds of confusion as to what you're actually doing.

also example.com won't resolve if you don't have a primary zone for example.com (all you seem to have is ns1. and ns2. which makes no sense in the manner you're attempting).
 
More details,

1. asmallorange
2. Linux Server running CentOS, think that's what you are asking
3. No Cpanel/WHM/Plesk
4. Basically I am just trying to get my site switched over from my shared account to my VPS account. Beyond that I am confused as fuck.

Hope that answers your questions.
 
Your stock CentOS install should be fairly easy to set up vhosts on with Apache -- can you host the DNS elsewhere (like with the registrar) so when the machine gets hacked or crashes at least your domains are still up (and maybe going to a backup server or something) ? Then at least you aren't just blindly cutting and pasting things in to a file and seeing if it works... *shrug*
 
Your stock CentOS install should be fairly easy to set up vhosts on with Apache -- can you host the DNS elsewhere (like with the registrar) so when the machine gets hacked or crashes at least your domains are still up (and maybe going to a backup server or something) ? Then at least you aren't just blindly cutting and pasting things in to a file and seeing if it works... *shrug*

My VPS on knownhost is setup in a similar manner, its also on CentOS. I disabled named, and either use the BIND server on my larger dedicated server, or using or of the free DNS servers.

In the case of not using a DNS server at all on the box, you would simply have to make sure you add the primary records to the DNS server that is handling it, for example if your box's primary IP is 11.22.33.44, and you got domainA.com setup in apache's vhost, then the DNS server could simply have an A record for DomainA.com going to 11.22.33.44 and a CNAME record for domaina.com going to DomainA.com.

Usually all there is to it, right now my VPS is setup with SSH, Nginx, MySQL.

As for the OP, if you got a VPS thats completely unmanaged, and you have absolutely no clue, then I strongly recommend one of two options.

1) Pay for the WHM/Cpanel upgrade.
2) Or Hire Someone who can set it up.

Because lets be honest, you might finally get it working tomorrow, but with your demonstration of server management skills, how long will it be before the server gets compromised because you forgot to close something, or when something seriously screws up and you can't seem to find anyone to help you fix it in a timely manner?