Fixing a Broken Bitnami Web Server on AWS Lightsail

English

The symptoms were:
The site was completely dead with errors like "Unable to connect." This was probably because I was trying to access it via HTTPS. When accessing it directly via the IP address, the default post-installation landing page showed up instead. It took me an absurd amount of time to resolve this (a solid half-day).

The Cause

While fumbling around trying to install Let's Encrypt, I must have installed something that automatically pulled in the standard `apache2` package. Then, after a reboot, the system launched the standard Apache instead of the Bitnami-managed one, showing its default welcome page. This is the classic annoyance of Bitnami: you should never carelessly run `apt install apache2` or related tools.

The Solution

I eventually found the official documentation. Since it took me half a day just to track this down and I thought it might take even longer, I actually spun up a brand-new Lightsail instance to rebuild it first.

https://aws.amazon.com/premiumsupport/knowledge-center/lightsail-troubleshoot-default-webpage/

Stop the system Apache2 service:

sudo systemctl stop apache2
sudo pkill -f apache

Start the Bitnami Apache service:

sudo /opt/bitnami/ctlscript.sh restart

Disable the system Apache2 service from starting on boot:

sudo systemctl disable apache2

What I Discovered Right Before Finding the Fix

Commands like `/opt/bitnami/ctrlscript.sh restart apache2` kept failing with "Failed...".

Because the wrong page was rendering, I spent ages investigating the DocumentRoot settings, but couldn't figure it out.

Checking the processes with the `ps` command on the newly recreated Lightsail instance, I saw that the correct, healthy server was running the Bitnami `httpd` process:

/opt/bitnami/apache2/conf/httpd.conf documentRoot "/opt/bitnami/apache/htdocs"

In contrast, on the broken, inaccessible server, standard `apache2` was running. That was the huge difference.

I struggled for a bit because standard `apache2` kept resurrecting itself even after being killed, but somehow I managed to get it to stay down.

Leave a Reply