WordPress + CloudFlare


CloudFlare is the latest ‘CDN’ (Content Delivery Network) by Amazon. What a Content Delivery Network means is that your files are cached by Amazon and when users visit your website the files are sent from Amazon’s servers instead of your own web server.

This of course means your website loads faster for viewers and your web server has less to do. CloudFlare enhances the awesomeness of a regular CDN and adds optimizing of all of your files and images, as well as an ‘offline’ mode to make your website still usable even if your web server goes down, adds security against attacks, and is free!

Yeah it’s pretty awesome. Ok, my promotional speech is over…now I wish I was getting paid for this. 😛


So all you need to do to configure your website to use CloudFlare is:

  1. Register at https://www.cloudflare.com/

  2. Add your website. At this point CloudFlare will scan your A/CNAME/MX records so that it can duplicate them on Amazon’s side.

  3. On the next screen it will list all of the A/CNAME/MX records it found and let you know that it’s going to send traffic for www.yourwebsite.com to it’s CloudFlare cached copy of the page, and most other requests will be sent like normal to your web server (ex. ftp, mail). Note that as mentioned on that page, you should now use ftp.yourwebsite.com to access ftp.

  4. It’ll list some settings involving the performance and security levels but the default should be fine.

  5. It’ll then need you to update your name servers for your web host. So this is where the main change comes in. You need to go to the company you registered your domain name with and change your name server to Amazon’s name server. Thus every single request will actually route to Amazon’s web server and then any requests that CloudFlare decides should be passed to your server will be.

  6. Every thing should at that point just start working (it’ll take 24 hours for the switch to happen while the name server records are updated but there shouldn’t be any website downtime). The last thing that you may want to do is get a WordPress plugin for managing the CloudFlare account. This can be done by getting your API key from the CloudFlare account page and then either:

    • Installing the W3 Total Cache plugin, going to Performance > General Settings > Network Performance and Settings Powered by CloudFlare, and entering in your email and API key.
    • or installing the WordPress CloudFlare plugin and entering your email and API key in its settings page.

Really that was it. I’ve had one issue so far where a page that was attempting to display a ‘PHP warning on line 168’ type of error was instead just showing a generic CloudFlare page not found error which made debugging difficult. But CloudFlare can always be temporarily turned off from the CloudFlare website. I imagine there will be more issues with the mixed requests going to different servers, but so far it really is just working with essentially no configuration other than changing my DNS records.

Leave a Comment

Previous post:

Next post: