Multiple WordPress Installs On One Lightsail Bitnami WordPress Box

I found it tedious trying to change all of my websites (6 in total) to Amazon’s Lightsail Bitnami WordPress box. There are many instructions on how to do this using the WordPress Multisite feature, but not if you actually need individual WordPress installations on the same box.

Anyway, after destroying a couple of boxes because of incorrect configurations I was finally able to develop a process to get myself going and here is that process.

(I’ve assumed from the start you’ve been able to start up an AWS Lightsail Bitnami instance and have successfully SSH’d into it)

Step 1: Download WordPress & Bitnami’s WordPress Module Installer

From inside your shell, download the files needed.

  1. Download the latest Bitnami WordPress module for Linux:
$ sudo wget https://bitnami.com/redirect/to/1135599/bitnami-wordpress-5.5.3-0-module-linux-x64-installer.run

Step 2: Run Bitnami WordPress Module

We’ll first start with Bitnami doing it’s thing in setting up a new WordPress installation alongside the default wordpress one in the ~/apps directory.

  1. First, make the newly downloaded file executable.
$ sudo chmod +x bitnami-wordpress-5.5.3-0-module-linux-x64-installer.run

2. Before you execute the file, fetch the MySQL password:

$ cat bitnami_application_password

The resulting output will need to be copied and pasted somewhere for use later.

3. Now execute the Bitnami module, changing the name NEW_WORDPRESS_FOLDER_NAME to a more succinct name for your new WordPress installation.

$ sudo ./bitnami-wordpress-5.5.3-0-module-linux-x64-installer.run --wordpress_instance_name NEW_WORDPRESS_FOLDER_NAME

For example, if I was creating a website called scripteverything.com maybe I’d like to call the directory where everything will reside se, therefore my command would look like this:

$ sudo ./bitnami-wordpress-5.5.3-0-module-linux-x64-installer.run --wordpress_instance_name se 

Follow through the prompts providing the necessary answers, here were some of my responses:

  • Location of Bitnami stack: /opt/bitnami
  • If prompted for an admin username, create one (perhaps use your first and last name as the admin user).
  • Paste in the MySQL password from step 2 when prompted.
  • Give your blog a name.
  • You could enable mail support, but I didn’t.
  • Then when you’re almost done it will ask if you’d like to launch the Bitnami stack: Y

4. When the module has finished installing we would like to add our domain to the newly installed directory, this will require the following command:

$ sudo ~/apps/YOUR_NEW_WORDPRESS_FOLDER/bnconfig --appdomain YOUR_DOMAIN_NAME

For example, if I were to continue with the same example previously of using this very domain, scripteverything.com then I would be running the following:

$ sudo ~/apps/se/bnconfig --appdomain scripteverything.com

This shouldn’t take as long as the first command, but a little patience is required. You could also modify the previous command by running the following if you wanted to disable the Bitnami banner:

$ sudo ~/apps/se/bnconfig --appdomain scripteverything.com --disable_banner 1

Step 3: Create SSL Certificate

Next we’ll run the bncert-tool to create an SSL certificate for our new domain:

$ sudo /opt/bitnami/bncert-tool

Here you’ll progress through another series of prompts about the domain you want to register. Read each prompt carefully and ensure your DNS A-record is correctly pointing to the IP address of your Bitnami WordPress box.

Once you have successfully created the certificates, you’ll need to modify your app’s Apache configuration to point to these new files:

$ sudo vi ~/apps/YOUR_WORDPRESS_DIRECTORY/conf

Here you’ll see a listing of the files in the conf directory, using your arrow keys on the keyboard navigate down to the httpd-vhosts.conf file and hit Enter to open this file up in Vim.

You will need to edit the following lines in the file to point to your newly created SSL files, here are the two lines you need to change, they start with SSLCertificateFile and SSLCertificateKeyFile:

SSLCertificateFile "/opt/bitnami/apache2/conf/scripteverything.com.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/scripteverything.com.key"   

You need to point these files to where the files are located in the apache2/conf folder.

Close the file by saving your edits – in Vim to edit you need to hit the i key, then when you’ve finished editing hit the Escape key and to save your edits enter :wq

To finally check that everything is working fine you need to restart:

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

You should then see something like this if everything is okay:

Unmonitored apache
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Monitored apache

You can then navigate to your URL and you should see a blank WordPress installation!

To login in use your admin username you created above, and use the password you provided, or the MySQL password.

Conclusion

In this article we discovered how to add another WordPress installation to our Bitnami WordPress box, without using the Multisite instance.

You can install as many instances as you wish, and if you ever want to remove an installation simply run the following command:

$ sudo ~/apps/WORDPRESS_FOLDER_NAME/uninstall

This will completely remove all the files in that folder, and when prompted even the data in the MySQL database if desired.