How To Install Multiple WordPress Sites On One Bitnami Stack


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

Modify httpd-vhosts.conf File

Before running this step you need to comment out the references to the SSL certificates in the httpd-vhosts.conf file. Open this file up and edit:

$ vi ~/apps/YOUR_WORDPRESS_DIRECTORY/conf/httpd-vhosts.conf

The lines you will want to comment out for now will be the following:

#    SSLCertificateFile "/opt/bitnami/apps/WP_DIR/conf/certs/server.crt"
#    SSLCertificateKeyFile "/opt/bitnami/apps/WP_DIR/conf/certs/server.key"

Where WP_DIR is YOUR_WORDPRESS_DIRECTORY and # represents the commenting out of those lines. Save and close the file.

Check DNS Records

One final check before you progress is to ensure that your DNS points to the IP address of your server. You will want the A-record of your domain to point to your IP address and the www CNAME of your website to either similarly point to your IP address or to be redirected to root.

Run Let’s Encrypt

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.

Here were the prompts and my corresponding responses for registering this domain:

Bitnami HTTPS Configuration Tool – PromptMy Response
Please provide a valid space-separated list of domains for which you wish to configure your web server.
Domain list []:



scripteverything.com
The following domains were not included: www.scripteverything.com. Do you want to add them? [Y/n]:Y
Enable/disable redirections
Please select the redirections you wish to enable or disable on your Bitnami installation.
Enable HTTP to HTTPS redirection [Y/n]:
Enable non-www to www redirection [Y/n]:



n
Y
Changes to perform
The following changes will be performed to your Bitnami installation:
Stop web server
Configure web server to use a free Let's Encrypt certificate for the domains: scripteverything.com www.scripteverything.com
Configure a cron job to automatically renew the certificate each month
Configure web server name to: scripteverything.com
Enable HTTP to HTTPS redirection (example: redirect
http://scripteverything.com to https://scripteverything.com)
Enable www to non-www redirection (example: redirect
www.scripteverything.com to scripteverything.com)
Start web server once all changes have been performed
Do you agree to these changes? [Y/n]:
Y
Create a free HTTPS certificate with Let's Encrypt
Please provide a valid e-mail address for which to associate your Let's Encrypt certificate.
Domain list: scripteverything.com www.scripteverything.com
Server name: scripteverything.com
E-mail address []:
I entered my email address
The Let's Encrypt Subscriber Agreement can be found at:
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]:
Y
Configuring my SSL certificates for this domain

You may get an error at the end of the process stating that your web server failed to start. Go back to your httpd-vhosts.conf file and change the commented lines to point to the newly created certificates.

You can check the certificates have been created by navigating here first:

$ cd /opt/bitnami/apache2/conf

Then check the list of files in this folder and you should see:

$ ls
scripteverything.com.crt   scripteverything.com.key

This location is now what you need to replace into your httpd-vhosts.conf file.

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.

Recent Posts