Moving WordPress sites from Dreamhost to Linode

July 20, 2013

Just a short note to detail how I moved this site (and to Linode. I was a bit annoyed with the poor performance I’ve been getting from the Dreamhost servers, and also from their support team. I can’t blame them though, they gave me exactly what I asked for at a very reasonable price. I’ll continue to use them for DNS hosting.

UPDATE: Even more stinging than the poor performance was learning that Dreamhost now has an option for high performance WordPress. Super, if only it was part of the standard offering and not $20 per month extra per domain. At any rate, that was not available when I made the decision to move. If this is too much for you then consider switching your existing WordPress One-Click Install on Dreamhost to their Optimized WordPress Hosting.

First, just some background on how I came to know that Dreamhost was not performing. I used a combination of Google PageSpeed Tools and to show that there was a lot of room for improvement. The common problem was the time to load the first byte and I learned that this is largely due to the fact that the shared hosting providers write sites to swap (disk) and pause the processes to get more sites on the same piece of hardware. Of course this means that the site is slow to wake back up after a period of inactivity as it has to load from disk and start that process again, leading to the 30 sec times to first byte.

With that in mind, here is how I moved from Dreamhost to Linode for my WordPress sites:

1) Signup for Linode, and choose the 64-bit Debian 7 image

2) Follow the Getting Started guide

3) Add the dotdeb sources

4) Install exim to send email (this is needed to send password reset emails from WordPress)

5) Install php-fpm, nginx, mysql, etc

sudo apt-get install nginx php5-fpm php5-mysql mysql-server

6) Perform a database backup on Dreamhost

(setup SSH access to your Dreamhost account for this if you haven’t done this already)

mysqldump --opt --user=username --password=password --host=yourMySQLHostname dbname > output.sql

7) Set up a MySQL database on your Linode host

8) Restore the DB on the Linode host

mysql -u username -p dbname < ~/output.sql

9) Copy your existing WordPress directory over

You could use SCP for this. I decided to chuck everything into a Bitbucket repo and version the wordpress install should I ever need to rollback (unlikely). It is not great for binary files – like images, videos, etc. – although most of those are hosted elsewhere and it is just the ones included with the WordPress theme.

The following instructions expect that you have created a directory under /srv/www/ for the WordPress installation.

10) Set up the nginx-conf (server block, virtual host equivalent for those familiar with Apache)

I followed the instructions provided by Evan Solomon. Start by copying his config file and making changes relevant to your server and site. Then run

sudo ln -s /srv/www/ /etc/nginx/sites-enabled/

11) Update the DNS records on Dreamhost to point to your Linode machine OR consider CloudFlare for minifying JS & CSS. If you use Cloudflare you’ll be switching your primary and secondary nameservers to them.

12) You’re good to go!

Enjoy this post? React on Twitter: