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

by Alan Bracken in AWS Hosting on June 3, 2020
WordPress in AWS Lightsail (Bitnami AMI)

# restart apache
$ sudo /opt/bitnami/ctlscript.sh restart apache

# remove bitnami banner
$ sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
$ sudo /opt/bitnami/ctlscript.sh restart apache

# ssl configuration
$ sudo /opt/bitnami/bncert-tool

# 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

# 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

# installing awscli
$ sudo apt install awscli
$ aws configure (add key, secret and region)

# 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)

# increase WordPress memory limit define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

# run mysql query from CLI
mysql -u root -p bitnami_wordpress -e "SELECT * FROM wp_users"

Share Your Valuable Opinions

WP Feedback

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