How to Fix the default URL in WordPress settings on Lightsail AWS Instance?

Introduction:

Amazon Lightsail is a web service that provides an easy-to-use platform for deploying and managing virtual private servers (instances) on the Amazon Web Services (AWS) cloud.

Procedure:

Step1:

Login at https://lightsail.aws.amazon.com/ls/webapp/home/instance and for the instance you want to change click the SSH connect icon:

Step 2:

In the terminal window type.
Open wp-config.php with the below command.

$ cd /opt/bitnami/wordpress/
$ vi wp-config.php

Step 3:

Change the below lines in wp-config.php

use the down arrow on your keyboard to find the lines that contain the code:

define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);
define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);

TO

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

then save the file and close the Terminal window.

Step 4:

Go back to the instance page and click reboot.

Step 5:

once it has come back up – log into your WordPress admin > go to Settings >  general and you should see it.

Saikrishna Areddy

Sai Krishna is a DevOps Engineer at Pheonix Solutions with 4.5 years of experience in cloud infrastructure, Linux administration, Docker, CI/CD, monitoring, backups, and security. His expertise includes infrastructure management, troubleshooting, and maintaining reliable and secure environments.

Leave a Reply

Scroll to Top