If you come across the error /opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started when you try restarting apache server by running the command sudo /opt/bitnami/ctlscript.sh restart apache, there is a quick way to solve this.
I faced this issue when my AWS EC2 instance was stuck and I had to reboot the instance. After the instance was rebooted, the site was still down as the apache server was inactive because the port 80 was occupied by nginx process.
How to Fix httpd could not be started error?
Step 1: Check if your apache server can start/already running by entering the command sudo /opt/bitnami/ctlscript.sh start apache
Step 2: If the apache servers are not active, you will get this status with error message httpd could not be started.

Step 3: There must be some other process blocking the socket / port 80 and you need to kill it. In my case, it was ngix process. Kill ngix and kill apache too.
sudo pkill -f nginx
sudo pkill -f apache
Step 4: Now start apache using this command
sudo /opt/bitnami/ctlscript.sh start apache
Hopefully your apache should be working fine now, go ahead, refresh your website and comment what happened!
Add Comment