All Posts Tagged Tag: ‘cdn’
In a day and age where people routinely post their thoughts on Facebook, an unlinkable, unsearchable, corporate-controlled walled-”garden”, I’m a big fan of owning your own blog. Not only does it give you full creative control, but it’s free of censorship, gives you full ownership, is optimized for search engines and is fully linkable and shareable.
While WordPress.com may be suitable for most people, I prefer the flexibility of running my own server. One of the more affordable solutions is Amazon’s cloud-based Web Services (AWS). But, getting started with AWS can be overwhelming without a deep technical background. When I first installed WordPress on an AWS micro instance, it kept running out of memory and crashing. Then, when I installed a custom, responsive theme on a larger instance, it was still quite slow.
This guide will provide you a detailed, step by step approach to setting up your WordPress blog at AWS in a high performance, economical fashion using an AWS Micro (or Small) instance running on Apache with Varnish and the W3 Total Cache plugin to optimize performance.
With a three year reserved micro instance, you can run a low traffic blog for $6.44 monthly (with the first year free for new AWS users). If you want a bit more room to grow, purchase a three year reserved small instance for a total monthly rate of $17.95 (what I currently use). Get more information on pricing options here. Ready to sign up for AWS? Already have an account?
Making WordPress Faster with Apache, Varnish and W3 Total Cache on Amazon AWS EC2 with CloudFront CDN
Update: There is now a much more complete tutorial to installing Varnish with W3 Total Cache and Amazon CloudFront here.
I recently set up this website on WordPress to consolidate my reference materials with my blogging efforts. For a long time, I’d used TypePad but as that service is no longer in active development, I decided to give WordPress another try.
Overall, I’m impressed with the progress WordPress has made over the years. However, running it on Amazon AWS EC2 with a sophisticated template (MySiteMyWay) turned out to be quite slow.
Now, as you can tell, my blog is quite speedy. Here are the solutions I ended up using.
- Amazon AWS EC2, CloudFront CDN, S3 – Three year reserved Small instance. Estimated monthly cost about $10 per month.
- WordPress 3.x
- Apache 2 on Ubuntu 12.0.4
- Varnish 3.x
- W3 Total Cache Plugin
- Google Sitemap Plugin
Basically, I run Varnish on port 80, the public http port. I run Apache on an internal port e.g. 8080. All public requests come into Varnish – if the page does not exist in the cache, it requests the page from Apache.
I set up W3 Total Cache to cache pages from my sitemap in the background. So, quite often, pages are loaded from the Varnish cache instantly. I’m storing my images, theme files and minified JS/CSS files in the Amazon CloudFront S3 bucket. In W3 TC, I have page cache, minify, object cache, browser cache, Varnish purging and CDN activated.
This setup is quite speedy and I’m very satisfied. The configuration files I’ve used are listed below the notes.
- CloudFlare: I may also add CloudFlare configuration soon – though it’s CDN features are redundant to CloudFront.
- NGINX: I experimented with NGINX but as I’m not as expert at this, I did not have much success.
- Amazon CloudFront: I found better performance by using only one CNAME rather than four. It seemed that browser clients were getting held up when I spread my CDN over multiple domains.
- Do not use multisite: I initially set it up on WordPress Multisite. I think in general the disadvantages of Multisite outweigh the advantages. It was difficult and time consuming, but I decided to switched back to single site model. Many plugins don’t work well on multisite which is also a problem.
Apache Ports Configuration
Apache Site Configuration for WordPress
Default Varnish Configration e.g. /etc/default/varnish
Varnish VCL Configuration e.g. /etc/varnish/default.vcl