External web host with GApps

Hello all!!! i was just getting lot of queries regarding setup of GApps with external web host. So basically using GApps for email hosting and using a separate web host for Web hosting.

Now we can have this kind of setup in two ways:

  1. using DNS hosting of web host
  2. using external DNS hosts

regarding differences in both i had given here 1st way is quite easy, it just need you to put Google’s mx records at web hosting control panel But you will need #2 in case of following things:

  • web host doesn’t allow using custom mx
  • you want to create cname records and web host is not giving option to do so
  • you can put only one mx record but still you want all emails on time with full redundancy
  • you also want to create advanced records like SPF, SRV etc

So here’s the info on #2 here i am giving some DNS related steps and tricks to do that.

Step 1 - Choose DNS Host

Now here you may choose your registrar’s dns hosting (if available) or else you can go with an external free dns host (remember free DNS hosts are highly reliable) you may go with:

Incase you need something with gurantee, you can try out Googleing for “paid external dns”

Step 2- create GApps records

Now here start creating GApps records….as

  1. MX records
  2. CNAME record for verification and custom URL
  3. Optional - SRV records - These are to enable usage of GTalk for GAPps account from outside of Google network. Here’s more info. - Google SRV records
  4. Optional - SRF records - These are to protect your domain from being used by spammers. in case you want to use ONLY GApps for sending mail on behalf of your domain, just create this “txt record” at dns hosting for root (domain.com) zone - v=spf1 include:aspmx.googlemail.com ~all

Step 3 - Configuring Web Hosting

To configure web hosting, you need to point root zone (i.e domain.com) and also subzones to web hosting server’s ip using “A record” Now here exists two possibilities:

  • your web host gave you web hosting server’s ip (sweet host!) :)
  • your web host gave you only nameservers and not any hosting server’s ip.

in 1st case ignore next section and scroll down and further instructions. here’s what to do in 2nd case to get ip of hosting server. Here’s the idea is just to query nameservers given by web host for “A records” of your domain. proceed as:

  • use any dns lookup tool, for simplicity i am using Zoneedit's nslookup tool
  • put your own domain in domain field
  • select record as “A record” for querying
  • use nameservers to query of your web host.
[anurag@root ~]$ dig harisri.in@ns1.anuragbhatia.com a
; <<>> DiG 9.2.4 <<>> harisri.in@ns1.anuragbhatia.com a
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 398
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;harisri.in@ns1.anuragbhatia.com. IN A
harisri.in@ns1.anuragbhatia.com. 60 IN A
;; Query time: 253 msec
;; WHEN: Mon Sep 29 16:23:41 2008
;; MSG SIZE rcvd: 65
[anurag@root ~]$

Now after getting ip of web hosting server just create the following records:

  1. A record for domain.com pointing to that ip
  2. A record for .domain.com* pointing to that ip

This will enable web hosting on domain.com as well as all subdomains (including www.domain.com)

Step 4 - Changing nameservers of domain

Now just change the nameservers of your domain. Point your domain to nameservers of the dns host you are using. And done!!! [ratings]