This is the procedure to add a new SSL protected website to WordPress Multisite Bitnami Instance. This procedure is to configure 1 let’s encrypt certificate per website. We will not be mixing domains/websites inside the Certificate SAN field.
Prerequsites:
- Site must be configured as
define( ‘SUBDOMAIN_INSTALL’, false ); in /opt/bitnami/apps/wordpress/htdocs/wp-config.php - /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf has an include for /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf
Step 1: Add New Site
My Sites>Network Admin>Sites>Add New
Populate the 4 fields with desired values. Do not worry about the Site Address (URL)* filed being a folder of rapturezone.com/ as this will be changed in a subsequent step.
Step 2: Change Site Address (URL) for new website
My Sites>Network Admin>Sites>Newom>Edit
Change the Site Address (URL)
from
rapturezone.com/newdomain
to
newdomain.com
Save Cheanges
Step 3: Backup crontab -e
Unfortunately every time you run the sudo /opt/bitnami/bncert-tool it will wipe out the crontab and leave only the latest certificate job. This results in all other certificates not being auto renewed.
crontab -e
copy and paste the current jobs to a temporary file
Step 4: Request Let’s Eecrypt TLS certificate
sudo /opt/bitnami/bncert-tool
Warning: Custom redirections are not supported in the Bitnami WordPress Multisite Stack. This tool will not be able to enable/disable redirections.
Enter
Welcome to the Bitnami HTTPS Configuration tool. Domains Please provide a valid space-separated list of domains for which you wish to configure your web server. Domain list []:
newdomain.com *.newdomain.com
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: newdomain.com www.newdomain.com Configure a cron job to automatically renew the certificate each month Configure web server name to: wordpress.rapturezone.com Start web server once all changes have been performed Do you agree to these changes? [Y/n]:
cert@newdomain.com
Success The Bitnami HTTPS Configuration Tool succeeded in modifying your installation. The configuration report is shown below. Backup files: /opt/bitnami/apache2/conf/httpd.conf.back.202113142318 /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf.back.202113142318 /opt/bitnami/apache2/conf/bitnami/bitnami.conf.back.202113142318 Find more details in the log file: /tmp/bncert-202113142318.log
Step 5: Add back previous crontab jobs
As mentioned in Step 3: Backup crontab -e. Crontab has been wiped out with only the latest certificate scheduled for renewal
crontab -e
Copy and paste back the previous jobs form temporary file in Step 3: Backup crontab
Step 6: Create a Virtual Host for New Domain
sudo nano /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf
Use the template below and add it to the existing Virtual Hosts
<VirtualHost *:80>
ServerName newdomain.com
ServerAlias *.newdomain.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName newdomain.com
ServerAlias *.newdomain.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/newdomain.com.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/newdomain.com.key"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
IMPORTANT: make sure the certificates exist otherwise the webserver will fail to start.
sudo /opt/bitnami/ctlscript.sh status
sudo /opt/bitnami/ctlscript.sh start
sudo /opt/bitnami/ctlscript.sh stop
Step 7: Optional Change
Currently if anyone tries to access the website by ip address it will get re-directed to newdomain.com
sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php
Change the value of
define( ‘DOMAIN_CURRENT_SITE’, ‘newdomain.com );
To anything you like.