Migrating WordPress to Amazon Lightsail

Written by Technical

Migrating WordPress to Amazon Lightsail

Starting a new WordPress website on Amazon Lightsail it is easy. One just has to login or open an account on Amazon Web Services, put in your payment details and choose the region for your instance, select the application and the plan of the instance. You have your blog up and running. For the first time, the login user is “User” and the password is in the installation for that you have to connect using SSH and type “ cat bitnami_application_password”.

The hardest is to migrate a running site to lightsail it took me three days to figure out what I was doing wrong. Here are the steps I took to migrate my complete Marine Hobby site from Godaddy to Amazon Lightsail.

  1. Install All in One WP Migration plugin on WordPress hosted on Godaddy.
  2. Start a new WordPress on AWS lightsail
  3. Run two command on the Lightsail SSH
    1. sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content
    2. sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs/wp-content 
  4. Download the SSH key from the AWS console and convert it to .ppk with PuTTYgen
  5. Download FileZilla and login to root server

There are three files that needs to be edited in the AWS Lightsail server before you can do anything. With FileZilla copy the files to your desktop and open them with WordPad.

  1. wp-config.php (/opt/bitnami/apps/wordpress)
  2. httpd.conf (/opt/bitnami/apache2/conf)
  3. php.ini (/opt/bitnami/php/etc)

wp-config.php

Right before “/* That’s all, stop editing! Happy publishing. */” add a code to increase Memory limit;

define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );

httpd.conf

To all upload of plugins and themes add code at the end of the file;

<IfModule reqtimeout_module>

   RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500

 </IfModule>

php.ini

Find “max_input_vars” and remove the “;” from the front of the line and increase the limit to 3000

Find “upload_max_filesize” and remove “;” from the front of the line and increase the limit to 512M

Find “post_max_size” and remove the “;” from the front and increase it to 512M

Find sendmail_path = “env -i /usr/sbin/sendmail -t -i” and remove the “;” from the front

Save the files and copy and overwrite the files back on the AWS Lightsail server. Now after doing all this reboot the instance from the AWS console. Login to the AWS WordPress install the All in One WP Migration plugin and Import the file from the Godaddy WordPress server. Use good connection internet and once the restore is done. We have our site migrated from Godaddy to AWS Lightsail. Now in the Networking tab on Lightsail console create a static ip and attach it to the instance and create a DNS Zone which you have to edit to the domain.

Now in the wp-config.php file edit code to your domain name

define(‘WP_SITEURL’,’https://yourdomainname.com/’);

define(‘WP_HOME’,’https://yourdomainname.com/’);

Reboot your Instance from the AWS console and Install the Let’s Encrypt SSL certificates. It takes about 24-48 hours to complete the whole process and get the domain to the point to the new server. If you are not able to do it try again but take a back up of all the old WordPress.

Must Read: SPAM Will Kill Me One Day

Last modified: July 15, 2019

Leave a Reply

Your email address will not be published. Required fields are marked *