Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaubert/1186264 to your computer and use it in GitHub Desktop.
Save gaubert/1186264 to your computer and use it in GitHub Desktop.

DNS and DotCloud

In the following, replace example.net with your domain name. XXX.XXX.XXX.XXX is the IP of the reverse proxy.

DNS entries

Required DNS entries

    example.net.         300    IN    A       XXX.XXX.XXX.XXX
www.example.net.         300    IN    CNAME   gateway.dotcloud.com

GMail-specific DNS entries

mail.example.net.        300    IN    CNAME ghs.google.com
     example.net.        300    IN    MX    30 aspmx2.googlemail.com.
     example.net.        300    IN    MX    30 aspmx3.googlemail.com.
     example.net.        300    IN    MX    20 alt1.aspmx.l.google.com.
     example.net.        300    IN    MX    10 aspmx.l.google.com.
     example.net.        300    IN    MX    30 aspmx5.googlemail.com.
     example.net.        300    IN    MX    20 alt2.aspmx.l.google.com.
     example.net.        300    IN    MX    30 aspmx4.googlemail.com.

Copy any TXT entries you added for proving to google you own the domain, these will still be needed!

CloudFlare-specific

Disable protection on direct.example.net, enable it for everything else. The reverse proxy at XXX.XXX.XXX.XXX should load direct.example.net. Add the following DNS entry:

        direct.example.net.         300    IN    CNAME   gateway.dotcloud.com
cf-protect-www.example.net.         300    IN    AAAA    2002:3210:bd68::d07c:100d

The IPv6 IP in the AAAA record is for gateway.dotcloud.com. Note that the IP may change. If it does, just run dig AAAA gateway.dotcloud.com to check it and use the IP it lists.

NOTE: I have not yet got IPv6 working on my VPS, so I have not bothered
      with getting IPv6 working on a "naked domain" (ie, example.net).
      Assuming you have an IPv6 address already, it should "just work"
      if nginx listens on an IPv6 address and you set up the reverse-proxy
      as normal.

Without CloudFlare

The reverse proxy at XXX.XXX.XXX.XXX should load www.example.net. No other DNS entries needed. IPv6 addresses for dotcloud are propagated via CNAME.

# nginx/conf/sites-available/example.net
# Reverse proxy to www.example.net, because I don't like www. and dotcloud is still working on "naked domain" support.
server {
listen 80;
server_name example.net;
access_log off;
error_log off;
#access_log /home/httpd/logs/example.net/access.log;
#error_log /home/httpd/logs/example.net/error.log;
location / {
#proxy_pass http://www.example.net; # Uncomment if not using cloudflare
proxy_pass http://direct.example.net/; # Uncomment if using cloudflare
proxy_redirect default;
#proxy_set_header Host www.example.net; # Uncomment if not using cloudflare
proxy_set_header Host direct.example.net; # Uncomment if using cloudflare
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment