How to use CDN to prevent visitors from reaching your server?

  • Posted September 19, 2014

Does anyone have any experience with CDN? I have been struggling with traffic spikes lately, which would overload Apache/MySQL and kill the server.

To dip my toes into CDN I have been using CloudFlare’s free service, but this hasn’t prevented traffic spikes from killing my server.

I have been reading about assigning a separate domain for static content i.e. images … would this help ease server load? Where can I find more information how to set this up?

Appreciate your help. For reference, the website I am referring to is ASTIG.PH.


A CDN is ideal to mitigate traffic spikes and also to improve performance. I use DigitalOcean in combination with KeyCDN A CDN will definitely take away traffic from your origin server (droplet). As you mention it’s common practice to create a subdomain for your static assets (e.g. This subdomain will then point to the CDN and that’s how you offload traffic away from your droplet.

This comment has been deleted

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I have used Cloudflare, but now I use this cdn service, more effective pricing model for me. I pay only for data transfer.

Thanks byte232. I realized that CloudFlare does not cache html files.

CloudFlare helps. I have used them myself. Have you considered something like Varnish cache?

I am guessing at how to use a separate domain for static content. Since nobody else has answered on the topic, my guess is that you would either have to rewrite your pages to bring in the static content from a separate domain or use a rewrite based on the directories that contain your static content.