The state “Highly Optimized WordPress Blog” is very hard to achieve. It’ll be a nightmare to most of the bloggers out there. At least it was for me, but no longer. I found a perfect solution for making my WordPress blog faster. And I’m writing this post to share it with you guys. This post is for people have a VPS or willing to invest on a one.
So this is not about tuning WordPress settings or configuring a caching plugin. Although those things help, it doesn’t make big impact on speeds. You’ll need a good server setup to go with all other WordPress tuning stuff to make good improvement in speed. Needless to say you’ll need a VPS. You don’t get much control over the server in shared platform; therefore this’ll be impossible to do.
The method I’m going to introduce here is bash script called LEMPress written by Jason Ormand. Considering all the work need to set up a server, LEMPress needs almost nothing from your side. It builds the server and installs WordPress automatically. Your first WP blog will be available in less than 10 minutes. Yes, I’m serious. Gone are the days it took hours to get a server configured.
What LEMPress Does?
It simply build server from the scratch. It installs and configures NGINX, Varnish, MySQL and PHP in the server setup part and installs WordPress in site setup part. If you do this manually, it’ll take days to get your site up and running. Thanks to Jason Ormand, you’ll be up and running in less than an hour.
Requirements and Known Issues
Script is written for Ubuntu. I have tested it on Ubuntu 11.04 and Ubuntu 11.10. Author tested it on Ubuntu 12.04. So I recommend you do a fresh OS install with one of those versions of Ubuntu. And of course you’ll need root access to the server to do it. Doing it will delete any existing data or websites on the server.
The main purpose of the script is to setup WordPress on a highly optimized environment. It haven’t tested with other CMSs and unlikely to work with them. Default WordPress comment system will not work due to Varnish. Disqus is a better solution for WordPress comments.
Varnish also kills WordPress cookies from the front-end. Therefore Edit links and admin bar will not be available from the front-end of your site. This setup is not recommended for sites that uses WordPress cookies for front-end operations. This includes membership sites and sites with shopping carts.
LEMPress is hosted at Github. You can find setup instructions on read me section. I’m going to add few more necessary steps to the setup here. So I recommend following these instructions instead.
First we’ll need to clean the server. Packages like Apache2 and bind9 will come pre-installed with Ubuntu. There’s no point of keeping them since we’re not going to use them. So let’s remove them from the server. Login to server as root and run the following command.
apt-get purge apache2* bind9* samba*
And it’s a good idea to update the server before we start.
apt-get update apt-get upgrade
Let’s do a reboot also,
Log back in after the reboot and create a new user called “Ëœdeployer’ and login as deployer.
sudo useradd -d /home/deployer -s /bin/bash -G sudo -m deployer sudo passwd deployer su deployer cd ~
yes | sudo apt-get install git-core
Download LEMPress using Git and navigate to download directory.
git clone git://github.com/okor/LEMPress.git cd LEMPress
Setup the server
You’ll be asked for new MySQL root password. Set it and you’re good to go. Now let’s setup a WordPress site
You’ll have to type your domain name and MySQL root password into CLI during this step. You’ll find a fresh install of WordPress on your domain after you’ve finished this step. You can setup multiple WP sites on your server by running bash add_site.sh for each site.
Now you have a WordPress blog on a highly optimized hosting environment. Next step is to install a theme and some plugins. In this post we didn’t do anything about the security of our server. It’s very important to tighten security of your server and make your websites hack-proof. Follow security and speed optimization guide for Ubuntu to make your server hack-proof.