This post is the fifth of a 5-post series with step-by-step procedures that I followed recently to setup WordPress on AWS for this version of the website. In this post, post-installation configuration improvements are made to the AWS instance to support WordPress.
Increasing Memory Limits for Upload:
Some of the WordPress themes have zip file uploads that exceed the arbitrarily low thresholds (e.g., 2M bytes). To support these more typical scenarios, the memory limits, and a few other limits, will be increased by editing the ‘php.ini’ file.
Use SSH and log back into the AWS EC2 instance. Navigate to the following directory:
Edit the ‘php.ini’ file:
sudo nano php.ini
Use ctrl-w to search for each of the following parameters and find its location in ‘php.ini’. Increase the values to those shown (or leave unchanged if the default values are larger). Note that these parameters are not co-located, but scattered throughout the file.
memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 max_input_vars = 3000
Enter ctrl-x, type y, and return to save.
sudo systemctl restart apache2
Then, exit out of the remote session. Done!
Creating and Resuscitating an Amazon Machine Image (AMI):
Although the process to create an instance, setup keys, install a LAMP stack, and download/configure a WordPress installation is straightforward, it does take time. Add the time to setup and populate a WordPress website, it can take a non-trivial amount of time to repeat in case of a serious operational problem. AWS has the Amazon Machine Image (AMI) feature that with a few clicks can store a byte-by-byte copy of the entire instance. Highlight an instance and select ‘Create Image under Actions -> Image’:
Enter the name and description for the image and click ‘Create Image’.
To restore an image on a new instance within just a few minutes, select ‘AMIs’ from the left column on the EC2 dashboard. Select the image and click ‘Launch’ which will display the steps to create an instance and populate it with the selected AMI.
A few notes:
- Re-associate an existing Elastic IP to maintain the DNS website name.
- Always note and save the various usernames and passwords during installation.
- Always create a new key pair following the instructions described earlier in this 5-part series.
An essential operational activity of any WordPress website is conducting backups on a regular basis. Website backups are necessary for archival purposes and in the event that I move the website to a new AWS instance. For a WordPress site, both the WordPress database and folders/files need to be included in a backup. I use UpdraftPlus (a WordPress plug-in).
Ubuntu 16.04 LAMP server tutorial with Apache 2.4, PHP 7, and MariaDB (instead of MySQL)
How to install WordPress 4.5 on Ubuntu 16.04 LAMP
Ubuntu Forums – WordPress and PHP
Install LAMP Stack on Ubuntu 16.04