Apache will not restart: AWS Lightsail LAMP PHP 7 instance

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Other
bnsupport ID: f76b59ed-1942-614b-e105-601dbf961341
Description:
The command and response:

bitnami@ip-172-26-3-239:/opt/bitnami/apache2/htdocs/includes$ sudo /opt/bitnami/ctlscript.sh restart apache
Unmonitored apache
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : apache not running
Syntax OK
(99)Cannot assign requested address: AH00072: make_sock: could not bind to address 54.184.5.232:80
no listening sockets available, shutting down
AH00015: Unable to open logs
/opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started
Monitored apache

Following many similar posts here I've tried

Searching for processes on port 80 netstat -lnp | grep :80

killing any httpd processes sudo kill -9 httpd

Searching for processes using port 80 using sudo lsof -t -i:80

Stopping and restarting all with the bitnami script: sudo /opt/bitnami/ctlscript.sh start

Rebooting the instance

But the results are always the same.

Hi @ttheimer,

Is it possible that you installed the apache2 service from system packages, and that service may be running by default when you start the instance? You can check it by running the command:

sudo service --status-all

If the apache2 service appears in the list, you can stop/disable it from being started automatically by running:

sudo service apache2 stop
sudo service apache2 disable

After this, bitnami ctlscript should success starting the service.

Also, could you check what page is being served by accessing your site at port 80?

Looking forward to your feedback,
Alejandro

When I run "sudo service --status-all", "apache2" does not appear in the
list.

Also, could you check what page is being served by accessing your site
at port 80?
I'm not clear what is being asked here. Without Apache running, there is
no accessing of the site. The browser displays its own error page
"Unable to connect".

Thank you.

Tom

Hi @ttheimer,

Thanks for checking it. I apologize for not being clear enough. I suspected that the port was being already taken by another application, so I wanted to figure out which one was doing it, but it seems the issue may be something else.

I can see in your apache2/conf/httpd.conf file the line:

Listen 54.184.5.232:80

Could you confirm that this IP address is the correct one for your instance? Could you try changing it to Listen 80, so it will listen on all the network interfaces instead?

Regards,
Alejandro

Replacing the Listen statement containing the IP address with "Listen
80" allowed Apache to restart.

Thank you.

Any suggestions for researching why using the IP in the Listen statement
prevented a restart?

Thanks again.

Tom

Hi @ttheimer,

I'm glad it worked for you, thanks for letting us know.

I suspect the network interface of your instance only have an internal IP address, while being accessible publicly thanks to AWS's NAT mechanism. In this case, the system is not aware of the public IP address where it's being exposed, so Apache is not able to attach to it.

Regards,
Alejandro

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.