A WordPress Tale: The Rebuild

A WordPress Tale: The Rebuild

Now for the final post in this series.  Let’s walk through the steps that I took to move my WordPress site from GoDaddy to AWS Lightsail. setup mail, configure SSL/TLS and resolve minor user-created issues.


WordPress Move

Backup your old WordPress Site 

Thank god for those Updraft Plus backups that I took before that failed WP update made accessing plugins or plugin content impossible. 

  1. Install UpDraftPlus as a WordPress plugin on your old site.
  2. Backup WordPress components:  database, uploads, plugins, themes, and others.  UpDraftPlus will create 5 zipped files.  Unless you’ve configured backups to save somewhere else, by default the files are saved unto your old web server. Note you probably should configure backups to live somewhere other than your web server.
  3. Go to UpDraftPlus settings > backups. Download each of the 5 zipped files to your local computer.

Setup new WordPress Site

  1. From AWS console >  Lightsail, Create a new Bitnami WP instance. 
  2. Lightsail > Networking. Assign a static IP to your instance for both DNS and address persistence among reboots
  3. SSH into your newly created WP instance.  Run cat $HOME/bitnami_application_password to retrieve your WP admin password
  4. Log into WordPress admin page, http://<static ip>/wp-admin with username: user bitnami and the WP password retrieved from above step. 

Restore UpDraft Plus Backups into new WordPress Site

  1. Log into WordPress admin page, http://<static ip>/wp-admin, install UpdraftPlus WordPress plugin.  
  2. In Updraft settings, restore backup.  It will ask to upload the zipped files taken from your previous backup.  Restore backup.
  3. If your WordPress versions do not match, it’s okay.  When you login after the restore completes, WordPress will prompt you to update the database schema. 
  4. If you don’t know the login info for the restored WP database, SSH into your Lightsail instance and use wp-cli to reset password. 
  5. If your WordPress site looks okay, it’s DNS Time.   

Point DNS to new WordPress Site

  1. Go to AWS Console > Route 53. 
  2. Create a Host Zone with an ‘A’ record that points to your static IP address.  Also, collect the names of the AWS Name Servers.  

Update DNS on your old WordPress Site

  1. Go to your DNS settings for soon-to-be ex web host. Update your “A” record to point to static IP address and also update the Name Servers to point to the ones that you found listed on your Route 53 Host Zone.
  2. Initiate domain transfer from your registrar. You may have to unlock, disable privacy and approve the request. 

Mail

Because I had a domain-specific email address, I needed to factor this into my wordpress move (once the domain move complete).

While you can setup an SMTP server and dump email into an s3 bucket, I opted for the easy option:  AWS WorkMail. This allows you to use an external email client with IMAP and also access web-based mail. Because there is a per mailbox charge, if you had a lot of mailboxes, you may want to create rolling your own.

While you can setup WorkMail before your domain move is complete, the final steps require that your domain has been moved.

  1. Go to WorkMail, add a new organization
  2. Create a user account.  Because my email address is becky@beckyelliott.com, my user is “becky”
  3. Once your domain has been moved, you can assign it to the organization that you created.  During this step, you will need to follow WorkMail instructions and add some records to Route 53 DNS.
  4. When WorkMail has been configured, you will need to change your default domain away from the WorkMail organization to your newly transferred domain.  This will create your domain-specific email account.

SSL

See AWS ‘ Instructions for using Let’s Encrypt Certificate for SSL.  https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-using-lets-encrypt-certificates-with-wordpress

These certificates expire every 90 days.  If you want something more permanent, it won’t be free.  Also, if you have issues with seeing the DNS records that you’ve added for validation, you will want to check DNS.  I initially had issues because Route 53 because my domain registration and Route 53 listed different domain servers.

Minor Issues

Resolving Server Path Issues

  • Install Better Search Replace plugin and replace links into database to old path.
    A limitation to Bitnami WP is that you can’t have WordPress located in a subdirectory.  My previous WordPress address was http://beckyelliott.com/blog.  To prevent a  string of ‘Page Not Found’ errors, two changes need to be made:Install a WordPress plugin that searches and replaces within your WP database. Fix links between posts.   I searched for http://beckyelliott.com/blog — > https://beckyelliott.com
  • Add a redirect within your .htaccess.conf file.  Created redirect in htaccess file.

    <Directory “/opt/bitnami/apps/wordpress/htdocs/blog”>
    # Redirects to resolve wp migration and no subdirectories
    
    <IfModule rewrite_module>
       RewriteEngine On
       RewriteCond %{REQUEST_URI} ^/blog/(.*)$ 
       RewriteRule ^(.*) https://beckyelliott.com/%1 [R=302,NC]
    </IfModule>
    
    </Directory>

    You may be able to also find a WordPress plugin to handle the redirects. However, that creates a plugin dependency that can affect the availability of your content. 

Unable to create Lightsail Instance 
Initially, my account was not fully validated and I kept getting not authorized messages when I tried to create my Lightsail instance.  If you have this problem, you may want to double-check that you’ve entered a credit card in payment.  Don’t be like me.

DNS Name Servers
When I went to complete my domain transfer in Route 53, I was asked if I wanted my domain to use Route 53 name servers or the ones that I was already using.   The wording threw me off and I didn’t change the name servers. 

I erroneously assumed that moving from domain registration wouldn’t require updated name servers.  It does. While my site was still accessible, I had problems when I went to configure WorkMail and SSL.  Both of these require you to add txt entries into DNS. The mismatch of the name servers made this an impossible task.

Fortunately, the issue was easily resolved when I realized the mismatch and updated the Route 53 to match the servers listed in the domain registration.

Conclusion

Now that everything is up and configured, I’d like to wrap up this post with a moment of gratitude.

Thank you UpDraft Plus WordPress Backup Plugin.  You are the real MVP!  You made the WordPress backup and restore simple– even with the free version.  Initially, I felt skeptical that I could restore with those WordPress backups that I took. Surely, the free version wouldn’t be enough to handle both server names and WordPress versions that weren’t an exact match.  Thank you for proving me wrong. 

Becky Elliott

After dropping out of a liberal arts college that focused on reading and discussing the “Great Books”, Becky Elliott found her way to a career in IT. For 20+ years, she has held a number of roles in Dev and Ops, and the area in between the two. In working for organizations in which poor security practices can cost lives, she’s an ardent believer in integrating security through the entire design process. Becky holds a number of industry certifications including the Certified Information Systems Security Professional (CISSP).
%d bloggers like this: