Chris Mendez in Wordpress, AWS, EC2, LightSail

Bitnami WordPress Cheatsheet for AWS Lightsail

I'm currently working on two WordPress websites that have been pre-configured by Bitnami within a Virtual Private Cloud. Below are a few select commands I use all the time but only found them while scouring through forums and comment boxes. I hope this collection helps other WordPress managers save time.


How to install

Pick one:


Bitnami Specific Tricks

Remove Bitnami branding.

sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1  

Change machine hostname.

sudo /opt/bitnami/apps/wordpress/bnconfig --machine_hostname subdomain.domain.com  

Files, Paths, Directories

Apache Specific

Apache error logs.

nano /opt/bitnami/apache2/logs/  

Virtual Host.

nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf  

WordPress Specific

Access wp-config.php

nano ~/apps/wordpress/htdocs/wp-config.php  

Access wp-content directory.

cd /opt/bitnami/apps/wordpress/htdocs/wp-content/  

Themes directory

cd /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/  

Plug-ins directory.

cd /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/  

SSL

Path to pre-installed SSL certificate.

/opt/bitnami/apache2/conf/server.crt

Path to pre-installed private key.

/opt/bitnami/apache2/conf/server.key

Redirect non www to www.

Bitnami disables .htaccess by default files for security and performance reasons (Source, Source 2). Therefore, you can make edits in one of two other places.

Location 1

The first path is

/opt/bitnami/apps/wordpress/conf/htaccess.conf

Location 2

Open up bitnami.conf.

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

Add this VirtualHost

<VirtualHost _default_:80>  
...
  # Bitnami applications installed with a prefix URL (default)
  # BEGIN EDIT BELOW
</VirtualHost>


<VirtualHost *:80>  
    ServerName domain.com
    Redirect permanent / http://www.domain.com/
</VirtualHost>  

Source


Restart Servers

Restart everything.

sudo /opt/bitnami/ctlscript.sh restart  

Restart Apache only.

sudo /opt/bitnami/ctlscript.sh restart apache  

Restart MySQL only.

sudo /opt/bitnami/ctlscript.sh restart  mysql  

Ownership and Permissions

Plugins Directory

I see this error happen from time-to-time. You try to install a plug-in and you get an error about not being able to create a directory. More often than not, it has to do with permissions.

Change ownership.

sudo chown -R bitnami:daemon wp-content/  

Change permissions.

sudo chmod -R g+w wp-content/  

Robots.txt

This topic is slightly more complex so I created a dedicated tutorial. Read more