Bitnami WordPress on AWS Lightsail

Posted in WordPress on 25 July 2024

The Bitnami package for WordPress provides a quick one-click install solution for WordPress.

Once installed you’ll most likely need to replace the default install with your pre-existing WordPress website. Here are a few useful commands and steps to speed up the process.

SSL Certificate

Bitnami includes a script for setting-up and installing an OpenSSL on your instance. You’ll need to provide a list of the domain names, they all need to be pointing to your AWS instance. Then run the command:

sudo /opt/bitnami/bncert-tool

Database Export/Import

Databases can be easily imported through command line using a standard mysqldump and importing the file using a mysql command.

MySQL Database Backup and Restore via Command Line

File Permissions & Ownership

Once you’ve uploaded any plugins, other than those installed via the CMS or pre-installed. Run the following commands to reset the file permissions on the files and directories you’ve uploaded to plugins:

sudo find /home/bitnami/stack/wordpress/wp-content/plugins -type d -exec chmod 775 {} \;
sudo find /home/bitnami/stack/wordpress/wp-content/plugins -type f -exec chmod 644 {} \;
sudo chown -R bitnami:daemon /home/bitnami/stack/wordpress/wp-content/plugins/

Same for media uploads:

sudo find /home/bitnami/stack/wordpress/wp-content/uploads -type d -exec chmod 775 {} \;
sudo find /home/bitnami/stack/wordpress/wp-content/uploads -type f -exec chmod 644 {} \;
sudo chown -R bitnami:daemon /home/bitnami/stack/wordpress/wp-content/uploads/

These permissions will allow WordPress to manage the files and create directories (e.g. automatic plugin updates).

Custom .htaccess Rules

If you need to add any custom rules that would typically be added to a .htaccess file, use the following instructions.

sudo nano /opt/bitnami/apache/conf/vhosts/htaccess/wordpress-htaccess.conf

This will open an Apache config tile where you can place your rules. First create a <Directory> tag with the location of the website’s root folder. Then add your .htaccess rules as usual…

<Directory "/opt/bitnami/wordpress">
   Redirect 301 /blog/ https://example.com/news/
</Directory>

The code above will 301 redirect /blog/ to https://example.com/news/

Related WordPress Posts

July 2024

Bitnami WordPress on AWS Lightsail

The Bitnami package for WordPress provides a quick one-click install solution for WordPress. Once installed you’ll most likely need to replace the default install with... Continue reading

January 2024

Creating a brand-promoting brochure website with WordPress

In today's digital age, establishing an online presence is crucial for businesses looking to promote their brand effectively. One powerful tool for achieving this is... Continue reading

November 2023

WordPress for charities and donation websites

In an era where digital presence is paramount, charities are increasingly turning to online platforms to raise awareness and funds for their causes. WordPress, with... Continue reading

More WordPress Posts