Skip to content

lightsail - apache seems to have vanished

0

It seems that Apache is no longer on my instance Lamp 7-1. This is the last entry in the access log file:

107.9.21.47 - - [10/Feb/2025:22:22:34 +0000] "GET /customerdisplay.php?theStore=batavia HTTP/1.1" 503 1384

Following the recommendations on other repost entrys, I ran the following in the terminal. I'm not sure what to do next.

Any help is appreciated:

Last login: Tue Feb 11 14:04:47 2025 from 50.5.216.133 bitnami@ip-172-26-6-34:$ sudo systemctl restart apache2 Failed to restart apache2.service: Unit apache2.service not found. bitnami@ip-172-26-6-34:$ sudo systemctl status apache2 ● apache2.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead) bitnami@ip-172-26-6-34:$ apache2 -v The program 'apache2' is currently not installed. You can install it by typing: sudo apt install apache2-bin bitnami@ip-172-26-6-34:$ dpkg --get-selections | grep apache bitnami@ip-172-26-6-34:$ command -v apache2 bitnami@ip-172-26-6-34:$ which apache2 bitnami@ip-172-26-6-34:$ sudo apache2ctl configtest sudo: apache2ctl: command not found bitnami@ip-172-26-6-34:$

asked 10 months ago108 views
2 Answers
1
Accepted Answer

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/

AWS
MODERATOR
answered 10 months ago
AWS
EXPERT
reviewed 9 months ago
-1

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:

  1. The systemctl commands fail to find the apache2 service.
  2. The apache2 command is not recognized, with the system suggesting you install it.
  3. No Apache-related packages are found when searching with dpkg.
  4. The apache2ctl command is not found.

To resolve this issue, you'll need to reinstall Apache. Here are the steps you can take:

  1. First, update your package list: sudo apt update

  2. Then, install Apache2: sudo apt install apache2

  3. After installation, start the Apache service: sudo systemctl start apache2

  4. Enable Apache to start on boot: sudo systemctl enable apache2

  5. 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:

  1. Check the status of services: sudo /opt/bitnami/ctlscript.sh status

  2. 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

answered 10 months 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

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.