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

I'm trying to set up my DNS properly so that I can have hosting through PHPFog and email services using MailGun. PHPFog has us redirect the naked domain to the www and then use a CNAME to point the www to PHPFog and mailgun provides the MX records to use. The problem I'm having is that I have no A record set up on Hover because when I do, the CNAME no longer works (?), or at least it seems that way because I am no longer seeing my site from PHPFog, I'm seeing a Hover landing page. I know all the records I need, I just can't seem to get them to play nicely together. I've been told Amazon's Route 53 should be able to solve my problem, but I haven't yet figured out how. I just need to have hosting at PHPFog and email services through MailGun.

As you can probably tell, I have only a very limited understanding of DNS, so forgive me if this is a silly question.

share|improve this question

migrated from stackoverflow.com Jul 6 '12 at 1:01

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

You cannot mix a CNAME and any other "common" record for the same name. That's by specification. Wikipedia will tell you more about the CNAME restrictions.

You solution here would probably look like:

example.com. MX 10 smtp1.example.com.
example.com. MX 20 smtp2.example.com.
example.com. A 4.3.2.1
www.example.com. CNAME example.com.
smtp1.example.com. A 1.2.3.4
smtp2.example.com. A 5.6.7.8

Where 1.2.3.4 is the IP address for your mail delivery server, smtp2 of IP 5.6.7.8 is a hypothetical backup mail delivery server (get one, get rid of the associated 2 lines if you don't care), 4.3.2.1 is the IP for your web server.

share|improve this answer
    
This did the trick, thank you for your help. –  Aaron Francis Jul 7 '12 at 15:21

Handling the redirect of www.example.com can be done with a simple CNAME record. PHPFog directions should include the correct target for the CNAME. You won't be able to receive mail addressed to the www sub-domain.

www.example.com.  IN  CNAME  phpfog.example.net

Mail servers are located by an MX record. Mailgun should provide a name for the mail server to target. I've included SPF records which you may want to include. If they provide multiple host names add more MX records. Some servers don't support the SPF record type, in which case SPF will use the TXT record.

example.com. IN  MX 10  mailgun.example.net
                 TXT    'v=spf1 MX -all'
                 SPF    'v=spf1 MX -all'

Your domain does not need an IP address, and shouldn't have one unless you have a server with a static address. However, this means your web site will only be available using the www sub-domain. Some (most?) browsers will handle this for users who don't include the www. portion of the name. If you do have a server, it can run a lightweight web server which redirects all traffic to the www sub-domain.

You will also need NS records for your domain, but those should already be configured.

share|improve this answer

Your Answer

 
discard

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.