Domain Registrar from Godaddy to Google Domains
October 21, 2015
Github Education Pack
October 22, 2015

New AWS + ServerPilot + CloudFlare Hosting Solution

This past weekend I had a few hours to work out the latest version of hosting this site. After my frustrations with self-signed SSL certificates I decided to just roll my own server in AWS a few days ago. Knowing that CloudFlare offers a free tier of CDN, a recent discovery, I’m not terribly concerned with the capacity of the server. I looked at the yearly pricing of a t2.micro ec2 box on this site here.

The bottom-line price was $151 for 3 years of service. This breaks down to roughly $4.20/mo. Comparing that to Godaddy’s $6.99/m0. this seems like a steal. And that’s only comparing one WordPress site…I run several. I migrated a total of 3 WP sites today so I figure my savings is roughly $17/mo. Getting the ec2 box online was very quick and easy. In fact, if you don’t already have an Amazon AWS account you could do this for free for the first year.

In my search for “how to make this super easy” I stumbled upon ServerPilot.io. This service will basically ssh into the new box and setup everything you need to get started. They also maintain the server by securing it via iptables and automatically updating the server and WordPress with all patches. It’s easy mode. ServerPilot.io has a quick walkthough of setting up the security group for the server if you’re not familiar with aws. You basically need to open 22, 80, and 443 to the world. The free tier will get you up and in about a minute.

A huge benefit of ServerPilot is that it’s super simple to install and operate multiple WP sites, or other applications, on this one server. If I decide to make a new site I don’t have to worry about hosting, I can just roll out a new site in a matter of minutes and point the DNS at the server IP. This is a simple way to have multiple managed WordPress sites on a cheap ec2 box.

The only gotcha of using ServerPilot in AWS is that AWS disables the root login by default, which ServerPilot requires. You will need to enable ssh login for “root” by manually editing /etc/ssh/sshd_config. You need to change “PasswordAuthentication” and “PermitRootLogin” to yes. You’ll also need to set a root password with “passwd”.

PermitRootLogin yes
PasswordAuthentication yes

Now that the site is up and running, I had to find a simple method to migrate the existing WordPress site from Godaddy Managed WordPress. I know this can be done somewhat easily manually, but I was really looking for an automated solution to take care of everything for me. I found WordPress Duplicator. This site was able to wrap up all the content on Godaddy into a package with an installation script. I downloaded the two files to my local machine and then scp’d them to the new server.

Upon putting the tarball and installation script into the “public” directory of the applicable new WP installation I just had to point my browser to it (ie: https://www.cyberbrian.net/installer.php) and click-through a few prompts. The site was then up and running and I only needed to change the DNS entries at Godaddy (who happens to also be my domain registrar) to point to the new site.

Once all was well with the site on the new server I setup CloudFlare as detailed in a previous post. Now the site is up and running with self-signed SSL certificates and CloudFlare is front-ending the site with SSL end-to-end. A few more features to add such as automated backups of the server and the WP installation and I should be good to go for a while.

2 Comments

  1. peter nnanna says:

    hello thanks you for your great post. i am a newbie to ubuntu and ssh. i am trying to connect my aws instance to serverpilot and I need your assistance. when i enter /etc/ssh/sshd_config.conf. is says no such directory then
    when i enter sudo vi /etc/ssh/sshd_config i not see the option to set PermitRootLogin and PasswordAuthentication. what i am doing wrong.

    • Brian says:

      Hey Peter,

      No worries. I just realized I added the “.conf” to the file name accidently…habit. I don’t think this has changed from previous version of Ubuntu, but I run 14.04. In the file “/etc/ssh/sshd_config” these are the positions of the settings you need to update:

      Line 28 – PermitRootLogin
      Line 52 – PasswordAuthentication

      Keep in mind this is assuming nothing has changed this file from it’s default. I’m a nano lover, so you can enable line numbers with this command: “nano -c /etc/ssh/sshd_config”

      Let me know if this helps

Leave a Reply

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