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

October 2024

What's going on between WordPress and WP Engine?

The disagreement between WordPress and WP Engine has sparked considerable debate within the WordPress community and could have important implications for users of the WordPress...

Continue reading

September 2024

Combining Laravel with WordPress

Combining Laravel with WordPress offers a unique and powerful approach to web development, blending the strengths of both platforms to create highly efficient, flexible, and...

Continue reading

September 2024

Switching from WordPress to ClassicPress

Switching a WordPress website over to ClassicPress can be done smoothly with minimal impact if approached carefully. The process involves a few key steps to...

Continue reading

More WordPress Posts