Creating a new WordPress Lightsail server is as easy as clicking a few buttons, but what if you want to add more WordPress sites to an existing server?
A new WordPress Lightsail server comes with one WordPress site preinstalled, however it is not clear how to add additional sites. There are some brief instructions from bitnami, but more work is needed to get a working solution.
https://docs.bitnami.com/installer/apps/wordpress/configuration/install-several-wordpress-modules/
Download the installer (for linux) from:
https://bitnami.com/stack/lamp/modules#wordpress
Currently:
https://bitnami.com/redirect/to/753986/bitnami-wordpress-5.2.4-0-module-linux-x64-installer.run
Install new instance, where 5.2.4-0 is the current version, examplecom is the site name, and PASSWORD is the bitnami application password
sudo chmod a+x bitnami-wordpress-
5.
2
.
4
-
0
-module-linux-x64-installer.run
sudo ./bitnami-wordpress-
5.
2
.
4
-
0
-module-linux-x64-installer.run --wordpress_instance_name
examplecom
--
prefix /opt/bitnami --base_password
PASSWORD
Define virtual host configuration
https://docs.bitnami.com/aws/components/apache/#how-to-create-a-virtual-host
In /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf, comment out include for examplecom.
# Include "/opt/bitnami/apps/examplecom/conf/httpd-prefix.conf"
In /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf, add include for examplecom.
Include "/opt/bitnami/apps/examplecom/conf/httpd-vhosts.conf"
In /opt/bitnami/apps/examplecom/conf/httpd-vhosts.conf, change vhost configuration to examplecom.
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot "/opt/bitnami/apps/examplecom/htdocs" Include "/opt/bitnami/apps/examplecom/conf/httpd-app.conf" </VirtualHost>
In /opt/bitnami/apps/examplecom/conf/httpd-app.conf, change Rewrite rules to
RewriteEngine On RewriteRule ^index\.php$ - [S=1] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L]
Change site URL in WordPress configuration. In /opt/bitnami/apps/examplecom/htdocs/wp-config.php.
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
Restart Apache
sudo /opt/bitnami/ctlscript.sh restart apache
Ensure that the HTTP website is working on AWS before proceeding to configure HTTPS.