049 CloudFlare

30 Aug 2013

CloudFlare makes our websites secure and load faster. We can get started with it with just some simple DNS settings to host our pages from github, aws ec2 or even our own computer. In this episode, with CloudFlare's free plan we will explore DNS records, CDN, apps and more!

Download video: mp4

Similar episodes: 014 Local Web Servers, 016 YSlow, 033 AWS

Background on CloudFlare

  1. Main website - Overview, Plans, Apps, Developers
  2. DNS record types

Things to learn with CloudFlare

1. add website

  1. create account and login
  2. add a website - get to know the various DNS record types and CloudFlare plans
  3. edit nameservers with your domain registrar and wait for 24 hours
  4. explore settings - development mode, cloudflare settings, page rules

2. add another website

another sub-domain

  1. add a sub-domain e.g. subdomain.build-podcast.com in your cpanel
  2. transfer a simple index.html to the appropriate folder via ftp
  3. visit subdomain.build-podcast.com - it's not available
  4. in CloudFlare, add a CNAME of subdomain with an alias os the website
  5. give it some time and visit subdomain.build-podcast.com

github pages

  1. More info: custom domain with github pages and custom domain for github project pages, multiple github pages and custom domain via dns
  2. add a sub-domain e.g. ghpages.build-podcast.com in your cpanel
  3. Create a simple index.html through a Github page repo, project pages
    • create a new github repo
    • create a file CNAME with the content ghpages.build-podcast.com
    • create new branch gh-pages
    • create a simple file index.html
    • visit url github-username.github.io/repo-name
  4. in CloudFlare, add a CNAME of ghpages that points to github-username.github.io
  5. visit ghpages.build-podcast.com

serve a page from my computer

  1. from my computer e.g. home.build-podcast.com
  2. See episode 014 Local Web Servers
  3. Check with the virtual hosts file on whe Server Name and the corresponding document root /private/etc/apache2/extra/httpd-vhosts.conf
  4. Start MAC's local apache server with sudo apachectl start
  5. Put a simple index.html page at port 80 at the document root
  6. In your router's network settings map the private port to the public port 80
  7. find out your ip address by checking ipchicken or other means
  8. visit the website url your-ip-address
  9. in CloudFlare, add a A Record of home that points to your-ip-address

aws webpage

  1. add a sub-domain e.g. aws.build-podcast.com in your cpanel
  2. Go to EC2 AWS Management Console and launch a new instance
  3. See episode 033 AWS - set the security group, download the secutiry file, install httpd, copy over a simple index.html
  4. visit the public dns url http://ec2-xx-xx-xx-xx.compute-x.amazonaws.com/
  5. Go to CloudFlare and create a new A record aws that points to the IP address found in the EC2 management console as part of the public dns information
  6. visit the website aws.build-podcast.com

3. apps

  1. CDNJS
  2. Google Analytics
  3. Google WebMaster Tools
  4. Better Browser
  5. Highlight
  6. Others

4. cloudflare api

  1. query for stats in the last 7 days with client API

    curl https://www.cloudflare.com/api_json.html -d 'a=stats' -d 'tkn=xxxxxxxxxxxxxxxxxxxxxxxxxxx' -d 'email=[email protected]' -d 'z=build-podcast.com' -d 'interval=30'
    

More Resources on CloudFlare

  1. How to setup CloudFlare with NameCheap
  2. CloudFlare Free content delivery network speed up website tip
  3. 10 Easy Steps to Setup CloudFlare CDN in WordPress
  4. CloudFlare CDN tutorial
  5. Video: CloudFlare setup
  6. Combine CloudFlare with CDN on your blog
  7. AWS Cloudfront - CloudFront vs CloudFlare: We have a winner

Build Link of this episode

ESO Cast by the European Southern Observatory