I’ve hosted myy blog on WordPress for years as it has given me an awesome service for free. I highly recommend it. However I found out the other day that it had been offline for a few months for being automatically flagged for violating their Terms and Conditions for some reason.
Well now is the time to start hosting myself! I’ve always wanted to try spinning up a meaningful Amazon instance – now is the perfect opportunity to do so.
SEO Boost and Page Speed
The speed that your page loads affects SEO rankings as it makes sense that a smoother user experience is better. After installing a free WordPress template and setting up CloudFront (discussed later) my website ranked 90/100 for page speed. I’m talking a few minutes work for an experienced installer.
Getting content from WordPress.com
If you need to export any content from an existing WordPress install, click Tools > Export. You should then be prompted to download a file with all of your Posts, Pages, Users.
Setting up AWS
The instructions utilize Amazon’s AMI Marketplace which is a market place of Amazon Machine Images. These are recipes for building an environment with no effort – just a few configuration inputs. The AMI I used will create an Amazon EC2 instance.
When connecting via SSH I received an error:
Permissions 0644 for ‘Mac.pem’ are too open
This was fixed with
chmod 400 mykey.pem
I then managed to SSH connect with:
ssh -i "/Users/seb/Downloads/Mac.pem" email@example.com
Removing Bitnami Logo
Bitnami thought it would be a great idea to put their logo in the bottom right of your website. Even though no one in their right mind would ever have that logo sitting there.
I ran these commands to remove it
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
sudo /opt/bitnami/ctlscript.sh restart apache
Route 53 DNS
I thought I’d give Amazon’s DNS a go too! So I forwarded my NameCheap name hosting to Amazon’s Route 53 service.
I changed my DNS to Custom DNS and pointed to the DNS settings that Route 53 gave me. In around 5 minutes I saw my AWS hosted web pages appear!
The machine should be somewhat locked down when it is first created. If you check the Security Groups tab under the EC2 instance, you will see Amazon Firewall rules showing allowed inbound ports and IPs. I changed the allowed IP addresses to only allow my home machine. I Googled “show my public IP” and took that IP and added /32 to the end to comply to CIDR notation.
A final step would be to validate and customizing any security settings. I recommend Googling “Ubuntu Hardening” to find some guides that will walk you through hardening security on your machine as well as setting automatic security updates.
Now that your EC2 instance is up and running, your next steps are to read up on the optional Amazon Web Application Firewall (WAF) architecture.