Hosting a WordPress blog/website on the AWS EC2 platform can be pretty useful when you know how to maintain Linux servers and want to tinker it yourself. (Free for your account first-year / then around €10/month) This is great for a small personal blog where you’ll do the maintenance and scalability yourself. (OS, databases, and WordPress upgrades) If you need something more robust and scalable, I usually advise going for WPMUDEV hosting €10 a month packed with there must have performance and security service.
In this post, I’ll show you how I like to host WordPress on EC2 with a Let’s Encrypt SSL certificate.
Start by following the up to date, AWS documentation on how to install WordPress on EC2 and register your domain on Route 53 :
- Register your domain name on AWS Route 53 (or other) :
- Install a clean WordPress blog on EC2 (Free-tier available) :
- Route the traffic from your Route 53 domain to the EC2 instance through an Elastic IP :
- Routing Traffic to an Amazon EC2 Instance
- Once you are routing the traffic to WordPress, you may have an issue logging in as it redirects to the old EC2 URL. To fix it, run the following command with your server information on the Linux server :
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar search-replace 'ec2-XXXXXX.compute.amazonaws.com' 'YOURDOMAINNAME.com' --path=/var/www/html --skip-columns=guid
Once this is set up and you have your ssh access run those commands :
Once all of those commands are successful, I usually install the ReallySimpleSSL Plugin to modify all your WordPress files to be SSL compliant.
That’s it your website is automatically redirected to HTTPS! (Look for the green lock next to your URL)
Note: If after all those steps you can’t load your site, check your EC2 Security Group Inbound Rules, it needs to allow SSL protocol everywhere.