Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site running on a hosting company.

Now I want to create a separate web app on my VPS and let it accessible via

How can I set the DNS to redirect to my VPS' ip address? CNAME or A Record?

Also, If I want to do a mail server on my VPS too, how to setup the DNS?


Existing site:
Location: some hosting company that I don't control. It's running PHP with nginx I guess (or aphache)

New site (that I'm working on):
Location: my VPS, it has an IP address, the VPS is running nodejs. It can run along with nginx but currently it's not.

I want the existing website continue working (as customer visit and I want customer to visit for some new features.

The two websites are NOT on the same server and not using the same IP address.

share|improve this question

closed as off-topic by Iain, kasperd, Cristian Ciupitu, mdpc, dawud Jun 1 '14 at 8:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Iain, kasperd, Cristian Ciupitu, dawud
If this question can be reworded to fit the rules in the help center, please edit the question.

Do you have access to the DNS control panel for this domain? If not, you will need to ask whoever does to do this for you. – Ladadadada May 31 '14 at 6:49

The question is unclear as to whether is hosted on the VPS or not.

If is not hosted on the VPS then it is irrelevant. You create as an A record pointed at your VPS, or as a CNAME of the machine name of the VPS if its a publicly resolvable A record.

If is hosted on the VPS and is an existing A record, you could create a CNAME pointing at You would have to set appropriate bindings on your web server software that the sites get served properly.

CNAME is essentially an alias. The advantage of using it is if there are multiple DNS records for a single host you only have to update one record (the A record) if the host IP changes.

For your mail you setup MX DNS records- just point them at your VPS and configure your mail server software.

EDITED because the question is a little vague.

share|improve this answer
But I read I cannot use CNAME with ip address? link – AZ. May 30 '14 at 21:54
That's what I said, and he wants a separate site on his VPS – squillman May 30 '14 at 22:44
@AZ - you cannot point a CNAME at an IP. CNAME is an alias to an existing host name. – bkr May 30 '14 at 22:47
@squillman I have edited my answer to try make it more clear but the question is still vague. – bkr May 30 '14 at 23:00
@bkr the existing site is NOT on the VPS. So sounds like I can just create a A record from app -> VPS IP? – AZ. May 31 '14 at 0:41

First of all, you should add a lot more info to your question, like, are you using Apache, Centos? red Hat, a Windows server? which version of Bind, etc, tec.

Anywyay I will suppose you are using a linux vps with apache

Using a VPS has its complications. I suggest you pay the extra USD 5 for a WHM/Cpanel license (depending on your provider)

Anyway, the DNS has nothing to do with the <=>

Both sites share the same ip, you have to create a differente virtual host in Apache, one for with a ServerAlias and another virtual host for

share|improve this answer
Sorry for the confusion. I just edited my question. They are not on the same server and not using the same IP – AZ. May 31 '14 at 0:38
Ok, so you have to edit you DNS zone by yourself and add an "A" record. If I were you, I would use, I find it easier to use and very powerful. Theres a free account you can do almost everything – Alejandro Angelico May 31 '14 at 15:58

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