- Newest
- Most votes
- Most comments
You control services on Bitnami-authored instances with: sudo /opt/bitnami/ctlscript.sh
When I run sudo systemctl restart apache2 on a new LAMP instance, I get the same error you do:
Failed to restart apache2.service: Unit apache2.service not found.
However with sudo /opt/bitnami/ctlscript.sh status I see:
apache already running
mariadb already running
php-fpm already running
Learn more here: https://docs.bitnami.com/aws/apps/wordpress/administration/control-services/
Based on the information provided, it appears that Apache has indeed been uninstalled or removed from your Lightsail LAMP instance. This is evident from several indicators in your terminal output:
- The systemctl commands fail to find the apache2 service.
- The apache2 command is not recognized, with the system suggesting you install it.
- No Apache-related packages are found when searching with dpkg.
- The apache2ctl command is not found.
To resolve this issue, you'll need to reinstall Apache. Here are the steps you can take:
-
First, update your package list: sudo apt update
-
Then, install Apache2: sudo apt install apache2
-
After installation, start the Apache service: sudo systemctl start apache2
-
Enable Apache to start on boot: sudo systemctl enable apache2
-
Check the status to ensure it's running: sudo systemctl status apache2
If you're using a Bitnami LAMP stack (which seems likely given the "bitnami@" prompt), the process might be slightly different. In this case, you should use Bitnami's control script:
-
Check the status of services: sudo /opt/bitnami/ctlscript.sh status
-
If Apache is not listed, you may need to reinstall the entire Bitnami stack.
After reinstalling Apache, make sure to restore your website files and configuration. If you have a recent backup or snapshot of your Lightsail instance from before this issue occurred, consider restoring from that to ensure all your data and configurations are intact.
It's unusual for Apache to disappear without any action from the user. You might want to investigate what could have caused this (e.g., recent updates, changes in configuration, or potential security issues) to prevent it from happening again in the future.
Sources
Unable to start/load apache2 on LightSail LAMP configuration | AWS re:Post
Website files at Lightsail Plesk just disappeared | AWS re:Post
Relevant content
- asked 5 years ago
- asked 6 years ago
- AWS OFFICIALUpdated 2 years ago

What is a snapshot? And can it help me in this situation.
See the response below to explain that Bitnami configures apache control differently that some other providers