“The Magic Pool” – Campaign Video for a Better Tourism in Burma
January 6, 2013 – 2:43 pm | Comments Off on “The Magic Pool” – Campaign Video for a Better Tourism in Burma

This spot entitled The Magic Pool was produced in Burma by the director Moe Thorn, featuring in the main role Adam Fraser as tourist. Please watch and share!

Read the full story »

Political issues inside Burma and abroad on a local, national and international level.


Articles on economy and business, both in Burma and in a broader global context.

Society and Culture

Education, health, environment, people, gender issues, culture, media, music, film and arts.


Books, films and the like – our bloggers checked them out and tell you what they think.

Analyses and Research

Analyses, science, technology and research for a deeper insight.

Home » burmablog.net
Email This Post

Your Own Origin Pull Content Delivery Network

Submitted by on March 25, 2011 – 6:29 pm2 Comments

This post is very off-topic but I hope my readers will nevertheless forgive me. It has to do with the numerous technical experiments I am doing behind the scenes for this website. Since our funding is something around zero, we have to do these things in our “garage workshop”. Below I’d like to share some of the results, which – I hope – may be useful for others. Although I’m not a professional programmer, others can start from here and develop the idea further, the way I was inspired by others.

The Task

While the cheapest form of a Content Delivery Network is probably Coral, this doesn’t actually help you to increase the speed of loading websites but merely distributes the traffic on the Internet. So I thought about a simple way to have at least one additional server for images etc. Even if the content is not stored all around the globe and close to a user, it can still help your primary server and leverage the ability of browsers to open parallel connections. All you need to do is keep copies of the files in the same folder structure on a second server and then access them instead of the original files.

Setting up the server is no problem. But how to synchronize the files? I have experimented with FTP to upload content to the second web space, however, to no avail. So I ended up with cobbling together my own origin pull CDN. Actually, it is extremely simple but it does it’s job. And it’s free. This is how it worked for me:

First, I created a subdomain on my server – let’s assume it has the URL cdn.example.com, while the main site can be found at www.example.com. For better performance you may want to host both on different servers. PHP must be enabled, as well as URL rewriting.

Then, I created a .htaccess file and saved it on the CDN server. The content looks like that:
Besides .htaccess, I put there two additional files: One, cache.php, does the actual creation of cached files into a folder named “cache” (needs to have the necessary permissions, try 0755 or 0777). The second, purge.php, needs to be launched from time to time and will purge expired files. cache.php: This code was inspired by and and it’s initial form copied from here. Don’t forget to modify your actually main URL. 

purge.php: The code is a slightly modified version of this one. This file needs to be called every x minutes or hours and will iterate through the cache directory and clean files that have expired. You can launch it with a cron job, or from one of your web pages (perhaps through an invisible iframe). If you like you can modify the expiry time.

You can use your new CDN server with WordPress in connection with plugins like W3 Super Cache or Total Cache (I haven’t tried the latter.)
Ah yes, one more thing to mention: Of course, I don’t take any responsibility whatsoever for these scripts. Use at your own risk.


EDIT: Meanwhile I have found a solution that is easier to set up and looks really good: At Speedy Mirror you can experiment with 5GB free traffic before you buy anything (currently 1TB for US$35).

photo: Stuck in Customs @Flickr

About the author

Christoph Amthor wrote 50 articles on this blog.

Christoph has worked for several years as journalist for print, radio and Internet before he co-founded the organization Burma Center Prague in 2006. Most time he spends in Prague, Czech Republic.

Share this Post:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • PDF
  • Technorati
  • FriendFeed
  • Ping.fm
  • Posterous
  • Reddit
  • Tumblr
  • Add to favorites
  • Identi.ca
  • LinkedIn

Related Posts:


  • Mike says:


    Why would you want to INCREASE your page load times? You want to decrease it.

    “this doesn’t actually help you to increase the speed of loading websites but merely distributes the traffic on the Internet.”

    Hey I’m just giving you S. Good article. As I work for one of the top CDNs, all I can say is we do a lot more than just “distribute your content on the Internet”.

    Let me know if you ever need CDN service??

    – Mike

    Agree or Disagree: Thumb up 0 Thumb down 0

    • Hi Mike,
      Thanks for the feedback and offer! I meant to increase the speed by decreasing the loading times. So the increase refers to the speed, not the time.
      Agree, most CDN services offer a lot more than distributing the traffic. I was merely looking at the needed features that I would not be able to do with the given server(s).
      We are still in the process of finding out how big our project will be dimensioned. I’ll get back to you if we’ll move to a more professional direction.

      Agree or Disagree: Thumb up 0 Thumb down 0