I restarted my Bitnami-hosted Amazon Lightsail instance, and now my website loads the Apache default page instead of my website.
Short description
Bitnami-hosted instances have their own web service, such as Apache and NGINX, preconfigured inside their stack on port 80. If you install the Apache2 package, then the new Apache2 service starts first after an instance reboot or stop and start. Also, the Apache2 package might be installed as a dependency when you install packages, such as python-certbot-apache.
Because the new Apache2 starts automatically and listens on port 80, the Apache that Bitmani provides can't start and listen on that port. Because the port is in use, the website loads the default Apache page from /var/www/html/index.html.
Resolution
To make sure that the Bitmani Apache starts after you stop, start, or reboot an instance, complete the following steps:
-
Run the following commands to stop the Apache2 service:
sudo systemctl stop apache2
sudo pkill -f apache
-
Run the following command to start Bitnami's Apache service:
sudo /opt/bitnami/ctlscript.sh restart
-
Run the following command so that the Apache2 service doesn't start on boot:
sudo systemctl disable apache2