The Server Side

Cutting away a Garbage Web Development Firm, Hosting a Wordpress Site on EC2 with Nginx/Ubuntu, and changing Instance Sizes

I mostly deal in Ruby and Javascript, but my mom’s law practice needed a site refresh and I decided to go the PHP-Wordpress-on-EC2 route, for cost and usability reasons.

Requirements:

  • My mom needed a clean-looking marketing site, not a rich web app
  • She wanted easy blogging capabilities
  • She needed a site able to handle small amount of traffic — less than 500 visits per month.
  • She needed something cheap.

 

Wordpress fits the bill pretty nicely on all of these accounts, and EC2 offers some nice cost benefit on its smaller instances. My other motivation was to trim out the company who previously hosted and developed my mom’s site — “Amicus Creative.” From my view, they’ve been taking advantage of her for years — charging $99 per month for “SEO.”

A side note: I’m beginning to despise the word “SEO” (Search Engine Optimization) because it’s so loaded…and something that shady people and companies sprinkle on their web development packages to make themselves seem more appealing and valuable. It’s snake oil in the age of the internet.

To be fair, I do not disparage the honest art of content marketing. That is, developing an online reputation via legitimate means by publishing relevant, quality content that people link to because they like it (not because you buy backlinks). I find, however, many people try to dupe non-technical people by flourishing the term SEO on their marketing sites, without describing exactly what they do (which is often nothing).

Note: If you are one of those non-technical folks looking to enlist a firm to perform search engine optimization, be sure that you know exactly what you’re getting. Google lists the typical responsibilities of optimizers here. Content development and keyword strategies should be a big part of it. Google is working avidly to prevent “SEO hacks,” so don’t subscribe to purveyors of them.

SEO is not magic fairy dust.

I investigated just what this company, Amicus Creative, claims that they do in terms of “SEO” and I determined that they had set up the meta tags within the HTML of her site to be relevant to keywords for her law practice (“elder law”, “estate planning” etc.), but this company did not run paid ads, or write blog posts, or create credible backlinks (SEMRush showed her site to have 0 backlinks), or run her social media…nothing. This SEO package was a farce and they needed to go.

So here’s what I did:

Getting up and Running

I investigated Heroku as a possibility for hosting a Wordpress site, since the Heroku deployment process is such a pleasure to work with over AWS (note: I haven’t used Elastic Beanstalk, so this comment implies using EC2, S3, etc. Even so, I love Heroku’s documentation and ease-of-use). Their CLI is straightforward and I love deploying with git. I found a fleshed out Heroku buildpack for Wordpress from XYU, which also integrates Facebook’s “Hip Hop Virtual Machine” which is a “Just in Time” compiler they wrote for optimizing load times for their sites (ones written in Hack and PHP).

But the fact that Heroku’s file system is read-only was a complication I didn’t immediately foresee. This fact would inhibit my mom or me from adding plugins or new themes. I didn’t want to go through the trouble of hosting media and other content on an S3 bucket and setting all of that up…maybe another time. In addition, there’s the added complication of the ClearDB MySQL and Memecache addons that you have to pay for through Heroku. It’s a package of performance and price that my mom just doesn’t need at the moment.

In the end, I decided it would just be more straightforward and flexible to set up a Wordpress site on EC2. There are a few great tutorials about how to go about the initial setup process like this one that I followed.

After inspecting my mom’s Google Analytics account, which showed 1000 sessions over four months, I determined that the “t2.small” EC2 tier was the way to go. Alas, I created the first version of her site on a “t2.micro” instance, which is a bit too small. So I had to make this change.

Steps to Adjusting an EC2 instance size

(This assumes you already set up Wordpress and a Mysql database on Nginx on Ubuntu)

  1. Shut down the existing instance.

  2. Select the new instance size by right-clicking on the instance and then clicking “Change Instance Size.”

  3. Restart the instance.

  4. You’ll notice that your IP address is different.

  5. SSH into your new instance using the command found by right-clicking the instance and selecting “Connect”. It should be the line with

ssh -i “…pem” …@…

(you will just use the same .pem file).

  1. If you configured your server with Nginx like I did, enter

sudo nano /etc/nginx/sites-available/your-site

and change the IP address after “server_name” to the new IP Amazon gives you. 7. Write out the new file and exit.

  1. Restart Nginx with the new configuration:

sudo service nginx restart

  1. Next, you have to adjust the Wordpress “Home” and “Site” URLs in the MySQL database. If you want to do this with command line, Google it. I prefer using MySQL Workbench, a GUI. There are many alternative clients, but they all should do the same thing. So, first, open MySQL Workbench (or similar MySQL client) and make a connection to your remote instance. There is an article on how to do that here.

  2. Change the Site and Home URLs to be the new IP address and you should be in business. Your site should be live at your new IP address just the way it was before (a caveat to this: I noticed that some of the widgets required that I re-upload pictures. But mostly everything should be exactly the same).

Posted on May 2
Written by Nick Roberts