I grew up in a small town into a family that liked guns. I’m not too experienced, but I used to love going to the gun range with my grandpa, and shooting his .22 at beer cans, and I couldn’t wait for…
A guide to setting up WordPress on Amazon Web Services (AWS), from getting a domain on Route 53, setting up EC2 Instances and adding SSL security certificates for improved Google rating. The entire process takes around 45 minutes of typing in commands.
This is mostly for so that I don’t have to jump all the hoops if and when I have to do this again. I won’t be defining most of the terms used here, I’ll just link to the original documentation in the references (at the end of the post) where you can get more information.
This will just be a less dense, step-by-step and, hopefully, easy to follow to get your new WordPress site/blog running on AWS. You certainly don’t need any programming/coding experience to follow this guide.
What you’ll need:
- PuTTygen (included in PuTTy)
Terminal (MacOS)
Security Key Pair (generated on AWS)
Domain name
a. I used Amazon (for the first time, because I was going to use AWS for everything else), which makes it easier to get everything running since they all share the same dashboard and can link easily. I’m not sure how difficult or easy it will be if you were using a different provider.
b. Basically, an Instance is a connected IP address that allows you to link a DNS to the domain name you bought. In your AWS dashboard, select Services and then EC2, and then Create Instance. Choose an Amazon Machine Image (I went with Amazon Linux 2 LTS Candidate AMI 2017.12.0 (HVM), SSD Volume Type 64-bit). Select Next until you get to Configure Security Group.
c. A Rule (SSH) is already selected. Just change the Source to My IP to limit access to your SSH server to only you. Then select Add Rule and select HTTP and HTTPS if you want to include SSL for your site/blog (which I recommend since Google uses that as criteria for how well your site rates). Select Review and Launch, then Launch, where it will prompt you to create a Private Key File which you’ll use to access your SSH server.
d. Give it a name and save it somewhere accessible. On MacOS, I recommend saving the file in the Home directory since that’s the first place Terminal looks when it is started. On Windows, feel free to save it anywhere. Your Instance is now ready.
e. In your AWS dashboard, navigate to Route 53, select Hosted Zones, Get Started and Create Hosted Zone. On the right panel, enter your domain name and select Create. It should automatically populate your nameservers. Go to your Instance and copy the public IP address, then navigate back to Route 53, select Hosted Zones. Click the domain you just registered on the list and it should open a Create Record Sets page.
f. Click on Create Record Set on top of the page and in the Create Record Set dialog on the right, type “www” in the Name area and your public IP address in the place for Value. Select Create. create an Alias to link your “domain.com” to “www.domain.com" so that both are accessible to users. Select Create Record Set on top the page, change the Alias radio button from No to Yes, in Alias Target enter your “www.domain.com" and select Create.
a. SSH to the Instance you created in Step 1b. In Windows, convert the .pem Private Key File that you created in Step 1c to a .ppk file that PuTTy understands by using PuTTygen. Open PuTTygen, select Load and select the .pem file you saved somewhere. Select Generate and select OK on the warnings to proceed and save the .ppk file somewhere accessible too. I saved it in the same folder as the .pem file. Close PuTTygen.
b. Open PuTTy if you’re on Windows and Terminal if you’re on MacOS. On Windows, you need a few steps before you SSH to your Instance. On PuTTy, enter ec2-user@your-public-IP-address (from your Instance in Step 1e). In the navigation Category on the left, expand the SSH category, select Auth and click on Browse to select your .ppk file for authentication. Select Open.
c. In the Terminal window that opens, click on the top left corner where the icon is and select Change Settings from the drop-down menu. In the navigation Category, expand the SSH category, select Tunnel and enter 8888 in Source Port and 127.0.0.1:8888 in the Destination field. Click add. You are connected to your SSH server.
On MacOS, run the following command to connect to and take ownership of the .pem file
Then
d. Setup server
Perform a quick software update on your instance
Get the latest MYSQL and PHP versions for Amazon Linux 2) — note MySQL is replaced with MariaDB
Install the latest versions from downloaded extras above
Start the Apache web server
Make sure the server starts automatically after every system reboot
Ensure that the Apache web server is running) — — stop if you have any errors
Test your progress so far by entering your public IP address into a browser. You should see the Apache Test Page. Otherwise, go from the beginning and find where you made a mistake.
e. Arrange permissions (to give the ec2-user user (and any future members of the apache group) permission to add, delete, and edit files in the Apache document root)
More commands
The output should be: ec2-user adm wheel apache systemd-journal
Change the ownership of /var/www and its contents to the apache group
Add group write permissions
More group permissions
f. Add SSL/HTTPS
Restart the Apache server
g. Get a free Trusted Certificate (so that visitors don’t see the warning screens from above)
Generate a 2048-bit RSA private key
Create a certificate signing request and complete the prompts that follow
Country Name — — Malaysia for instance is MY, and Nigeria is NG
Organization Name — — you got this
Organizational Unit Name — — department name eg marketing etc
Email Address — — a contact address here
h. Encrypt your server with Let’s Encrypt’ Certbot
Download Extra Packages for Enterprise Linux — EPEL repository
Install the downloaded packages
Enable EPEL
Confirm that EPEL is running
You should see a list with enabled next to the EPEL components
Edit the httpd.conf file
The file opens in the Terminal.
Save the file by holding Ctrl and X on your keyboard. Press “Y” when it asks if you want to save changes, and then Enter when it asks where. Your edits have been saved.
To restart Apache
Install Certbot packages and dependencies
Run Certbot
Follow the prompts, enter your contact email, and agree to most of it. Then select 2 to use HTTPS. When it completes, you get a congratulatory message.
Automate renewal of certificates after 90-day periods
Add a line like the following to match the description on the terminal.
39 1,13 * * * root certbot renew — no-self-upgrade
“39 1,13 * * *
“Schedules a command to be run at 01:39 and 13:39 every day. The selected values are arbitrary, but the Certbot developers suggest running the command at least twice daily. This guarantees that any certificate found to be compromised will be promptly revoked and replaced.”
Restart the cron daemon
Create a PHP file in the Apache document root
Delete the phpinfo.php file you just created for security reasons. You don’t want everyone seeing all that info
Install security settings for the MySQL DB
When prompted, press Enter for the current root password because there is none. Then choose a password for the database. Then press “Y” until the process completes.
Download the latest WordPress installation package
Log in as root user using your password from the mariadb install
Example, ‘computer’@’localhost’ IDENTIFIED BY ‘Password123456’;
Give your database a decriptive name eg WordPress-db
Give the user you created earlier ownership. Change values for `wordpress-db` and “wordpress-user” to the ones you created earlier
Clear the database and see your changes
Backup old config file and create a new one for editing
Open the WordPress config file for editing
Scroll down with the direction keys on your keyboard to find the following lines and replace them with the values created earlier
Save the file by holding Ctrl and X, then press “Y” at the prompt and then Enter to save the file.
Install WordPress
Edit the httpd.conf file
Scroll down to the line that says <Directory “/var/www/html”>. A few lines below, find “AllowOverride None”. Change to “AllowOverride All”.
MAKE ABSOLUTELY SURE YOU’RE IN THE <Directory “/var/www/html”> DIRECTORY AS THERE ARE SEVERAL AllowOverride LINES IN THE FILE.
Save the file by holding Ctrl and X, then press “Y” at the prompt and then Enter to save the file.
Change ownership of the file to the apache user
Change ownership of the file to the Apache group
Add group write permissions so that you can make changes
Add repeatable group write permissions so that you can make changes in the future
Restart the server to apply changes
Ensure that the httpd and database services start at every system boot
Ensure that your database server is running
Install the EPEL repository configuration package
Install the Remi repository configuration package
Install the yum-utils package (for the yum-config-manager command)
Enable the repository
Upgrade (the repository only provides PHP)
Check the installed PHP version and available extensions
Run and install the following
Open the PECL file
Locate the line
Delete -n and exit and save
Download the development tools and dependencies
Install Magick
At the prompt “Please provide the prefix of Imagemagick installation [autodetect] :” press Enter
open your php.ini file
Scroll to the end of the file and add the following line
extension=imagick.so
Look for and change the following
Save and exit (Ctrl + X, Y and then Enter)
To confirm, enter your domain name or public IP number in a browser and you should see the WordPress setup page.
Create a Site Title, a user name (choose something other than the usual admin/administrator/user/root, make it something unique) and a password, and THAT IS IT! Congrats!
References/additional information:
Playing Pic One is a easy as loading your wallet of choice with ETH. If you have ETH on an exchange or in a hardware wallet, withdraw or transfer to Metamask using your unique wallet address. We are…
It can be easy to forget the good things we have in life when challenges show up. The things we don’t like or difficult things can overshadow all the others we can be grateful for. If you want to…
Elon Musk ha estado en las noticias últimamente por su compra de Twitter por $ 43 mil millones, que aún no se ha finalizado pero será impulsada por la junta de Twitter. La obra ve al trillonario…