WordPress Developers – working with the AWS Lightsail Terminal? Here are a few commands that may be useful

WordPress in AWS Lightsail (Bitnami AMI)

If your instance was created from an AMI on or after version: "WordPress Certified by Bitnami and Automattic/5.8.0-2-r01 on Debian 10" after 05.08.21 use these commands

Setting file dir owner

				
					sudo chown daemon:daemon -R /opt/bitnami/wordpress
				
			

Setting file/dir permissions

				
					sudo chmod 644 /opt/bitnami/wordpress/.htaccess
				
			

Open wp-config.php in terminal editor

				
					sudo nano /opt/bitnami/wordpress/wp-config.php
				
			

Install WP CLI

				
					cd /opt/bitnami/wordpress
				
			

If you boot your instance with a bitnami AMI, the WP CLI comes preinstalled so first run this command to see if already installed

				
					wp --info
				
			

if there is no info output, proceed with installation

				
					curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
				
			
				
					php wp-cli.phar --info
				
			
				
					chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
				
			

finally, run this to test if installation is successful

				
					wp --info
				
			

Install AWS CLI (Data for demo purposes only, generate your own IAM keys for input)

				
					aws configure
				
			
				
					AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
				
			
				
					AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
				
			
				
					Default region name [None]: us-west-2
				
			
				
					Default output format [None]: json
				
			

Restart Apache

				
					sudo /opt/bitnami/ctlscript.sh restart apache
				
			

SSL configuration

				
					sudo /opt/bitnami/bncert-tool
				
			

Access php-ini file for editing

				
					sudo nano /opt/bitnami/php/etc/php.ini
				
			

Get root/user password for new lightsail instance

				
					sudo cat /home/bitnami/bitnami_credentials
				
			

Copy content from one S3 bucket to another

				
					aws s3 sync s3://SOURCE_BUCKET_NAME s3://NEW_BUCKET_NAME
				
			

Debug to file (wp-config.php)

				
					define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define( 'WP_DEBUG_DISPLAY', false );

				
			

Update WordPress automatically without using FTP (wp-config.php)

				
					define('FS_METHOD','direct');
				
			

Increase WordPress memory limit

				
					define('WP_MAX_MEMORY_LIMIT', '512M');
				
			

Run mysql query from CLI

				
					mysql -h localhost -u root -p bitnami_wordpress -e "SELECT * FROM wp_users"
				
			

How to swap out a string value from a large SQL file

				
					sudo sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' example.sql
				
			
If your instance was created from an AMI before version: "WordPress Certified by Bitnami and Automattic/5.8.0-2-r01 on Debian 10" before 05.08.21 use these commands

Setting file dir owner

				
					sudo chown daemon:daemon -R /opt/bitnami/apps/wordpress/htdocs
				
			

Setting file/dir permissions

				
					sudo chmod 644 /opt/bitnami/apps/wordpress/htdocs/.htaccess
				
			

Open wp-config.php in terminal editor

				
					sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php
				
			

Latest From @seahorsedata

Our offices are officially closed from Friday, Dec 24th to Thursday, Jan 6th. Please note that we have a small (overworked!) team covering critical operations during this period so if you please refrain from contacting support in this period unless absolutely necessary.

Seahorse would like to take the opportunity to wish you and yours a very happy holiday season and a prosperous and healthy New Year
#happnewyear2022 #seahorse #wordpress #wp2aws #happyholidays

Load More...
WP Feedback

Dive straight into the feedback!
Login below and you can start commenting using your own user instantly