Switching to a New Hosting Provider

Why I switched

I recently switched to a new hosting provider. I chose https://www.digitalocean.com. These are the reasons:

  • It give me twice as much ram and disk space for half the price.
  • It uses SSD drives
  • It has a simple, clean, responsive interface. (very important)
  • root access
  • private IP address.
  • No internal IP address pointing back to the providers internal infrastructure. (that can be good or bad. I like it because it is just one less thing i have to consider. But I can turn it on if i want it.)
  • uses KVM (my preference, does not imply others are worse or this is better in some way)
  • easy payment/usage terms
  • good documentation
  • good bandwidth.
  • full root access
  • provides IPv6 (at least in singapore, and it looks like it is provided in NY. Some day, I’ll need it)
  • DigitalOcean seems to have a good reputation.

It does have snapshots but they are not free. So I’ll continue to back things up using my home-grown method which should be good enough. Snapshots are nice, but I am on a budget.
On a 30gb disk running CentOS 7 and wordpress with three sites it took 3 minutes 26 seconds to generate a snapshot.

So basically, performance and cost were the main reasons for switching.

Here are my notes on switching my wordpress site from rackspace to digitalocean

These notes are for a simple site. This does require some downtime.

I use nginx, mariadb and php55w. All good information for hackers. But it’s wordpress and a good hacker can determine most of that information fairly easily.

For information on moving wordpress to another Linux operating systems see the following link:
http://www.zebulak.com/2014/06/moving-wordpress-linux-operating-system/

Create your droplet. This is easy and digital ocean has good documentation on how to do this.

If you are using digitalocean, centos 7 the droplets is configured without swap space. use this link to enable swapspace after you build the server
https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
https://logicdudes.com/how-to/setup-centos-7/create-swap-file
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-7

Set the TTL in DNS for the site to a new value of about 1 minute. I could only set mine to 30 minutes. for my needs that was good enough. If you own a domain name then you your domain name provider has probably provided you with an interface to control your DNS settings. You want to do this first
so that all the internet DNS caching is updated.

  • backup database on old server
# mysqldump -u root -p [databasename] > database_name.sql
# gzip database_name.sql
# scp database_name.sql.gz user@newserver: #use a differnt directory if you like.
create database on new server
# mysql -u root -p
mysql> CREATE DATABASE [database_name];
myslq> exit
mysql> GRANT ALL PRIVILEGES ON databasename.* TO “wordpressusername”@”hostname” IDENTIFIED BY “yourpassword”;
mysql> FLUSH PRIVILEGES;
mysql> exit
  • transfer the database file to the new server
# scp databasename.sql.gz user@newserver:
  • import the database
# gzip -d database_name.sql.gz
# mysql -u root -p database_name < database_name.sql
  • transfer the wordpress files over
    1. on the old server:
# cd /site/path
# disable as many plugins as possible.Especially W3 total cache
# tar cvf site_name_tar ./site_name
# gzip -9v site_name_tar
# scp site_name_tar.gz user@newserver:
  1. log into the new server
$ su – root
# cd /site/path
# tar xzvf /path/to/file/site_name_tar
  • check permissions on /site/path/wordpress_site
  • use chmod and chown if neccessary.
  • copy configuration files for apache or nginx over to the new server.

This is where it helps to keep a seperate configuration file for each server instance.

This is the point of no return ( not really but, you have to wait for those DNS timeouts.)

  • Change DNS settings. You will have to use your DNS providers interface to do this
  • point the old name to the new ip address.
  • disable the old sites webservers
  • restart nginx on the new site

check to make sure there were no errors and that all the error logs were created.
the new site should come up depending on the TTL. If you reset it to a minute as in the first step
It may take up to 1 minute for the site to come up.
Re enable and configure any plugins that were disabled and you feel still need to be enabled.

When I restored the database and untarred the files this was sufficient to get everything back as it was.
I did not have to import any other settings.

I had some problems with categories not being found.
I updated one and the problem went away for all of them. I don’t know what the root problem was but I
suspect stale cache may have been part of the problem.

Make sure everything starts on a reboot.
# systemctl enable php-fpm
# systemctl enable mariadb
# systemctl enable nginx
# systemctl start php-fpm
# systemctl start mariadb
# systemctl start nginx

Securing a wordpress/nginx site

https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/

W3 total Cache Notes

http://john-dugan.com/setup-w3tc-nginx/
http://elivz.com/blog/single/wordpress_with_w3tc_on_nginx/
http://danielmiessler.com/study/web-performance/

mysql performance settings

I used the following link to help set the performance settings. You’ll have to experiment with yours.
I did have to comment out the setting for “innodb-log-file-size”

https://tools.percona.com

Performance statistics

Provided by blitz.io

I dont ever expect to get 20,000 hits in the span of 1 minutes or 1000 users in the span of 1 minute. So these statistics look pretty good.

Date              Method  Host                Concurrency                Response Time   Hits  Errors   Timeouts     
12/06/2014 18:49  GET     www.zebulak.com     1-1000 users in 60 seconds    239 ms     20,694   10.0%     0.0%     
12/06/2014 18:38  GET     www.apriorifarm.com 1-1000 users in 60 seconds    237 ms     20,982    8.0%     0.0%     
12/06/2014 18:32  GET     www.apriorifarm.com 1-100 users in 60 seconds     42 ms       2,854    0.0%     0.0%

 Other performance sites:

PageSpeed Insights

Website speed test


Leave a Reply

Your email address will not be published. Required fields are marked *