Setting Up Wordpress on EC2
Howdy internet friend and welcome to my blog! In brief post I am going to share some quick lessons I learned when I set up WordPress instance for my wife on EC2. I’m not going to share the whole process because there are other blogs with step my step guides for that. Instead I want to share what I learned and the biggest takeaways so I can save myself some trouble in the future. This is initially going to be short so I can remind myself of the crucial things I don’t want to forget, and keep open the option of adding to it later. I also needed to make sure that I installed git and hugo on my Slackware machine so I can write my weekly update tomorrow morning. Anyway, this will be a short little post mostly for me but if you get value from it - bonus! If you don’t get any value from this, remember that the blog is free :)
Things I did and didn’t do
I learned a few things in working on this project. First, I learned that the instructions on A Cloud Guru for using CloudFormation were a little out of date. They made it seem like you could just select a Wordpress template and CloudFormation would do all the rest of the work and build it all out for you. Nowadays Amazon has a service called Lightsail that is supposed to do all the stuff that CloudFormation did, but they wanted to charge you a few bucks a mont. Since I wanted to learn how to do this and not just pay someone to maintain WordPress for me, I decided to try and figure it out myself. Finally, I learned that you can outsmart yourself. If you can’t figure out why you can’t access a resouce, remember that AWS security is deny-by-default. If you haven’t opened up access to your web server to the world over port 80, not even you will be able to access it. Don’t outsmart yourself!
Here are the lessons that I learned, in no particular order:
- Don’t use the standard Linux 2 AMI image, instead use the Linux AMI 2018.03.0 (HVM). For some reason the Linux 2 AMI uses an outdated version of PHP, version 5.3 IIRC. WordPress, however, requires at least PHP 5.6, and for that you’ll need the 2018.03.0 AMI and a special command
- Install PHP 5.6 with
yum install -y php56
- If you are getting an error when trying to update your theme, you forgot to set the permissions properly. Use the following command and you should be able to update the themes: sudo chown -R apache:apache /var/www/html
- If you can’t install MySQL or the right version of Apache, make sure you chose the right AMI
- Don’t outsmart yourself!
That’s it for now, internet friend. As I mentioned above this post was meant to be short to make sure that git and hugo were installed and to share a few things with myself before I forgot. Last night I stayed up way too late fighting with AWS and even though I am super tired today I wanted to make sure I didn’t forget those few important lessons. That’s it for now, check back tomorrow for the weekly update and as always, have a great day!
Click here for the previous post and click this link for the next post.