how to fix /etc/init.d/apache2 restart ... failed!

Vaxert

Vaxert

Administrator
Staff member
Owner
Super User
Joined
Jan 9, 2018
Messages
813
Reaction score
2,233
Points
93
Location
Zimbabe
When you try to restart the apic server and see this error...

/etc/init.d/apache2 restart
[....] Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
 failed!

and your status shows the following error

 apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Tue 2021-09-21 13:33:28 UTC; 12ms ago
  Process: 18904 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Sep 21 13:33:28 ubunto-server apachectl[18904]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Sep 21 13:33:28 ubunto-server apachectl[18904]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Sep 21 13:33:28 ubunto-server apachectl[18904]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Sep 21 13:33:28 ubunto-server apachectl[18904]: no listening sockets available, shutting down
Sep 21 13:33:28 ubunto-server apachectl[18904]: AH00015: Unable to open logs
Sep 21 13:33:28 ubunto-server apachectl[18904]: Action 'start' failed.
Sep 21 13:33:28 ubunto-server apachectl[18904]: The Apache error log may have more information.
Sep 21 13:33:28 ubunto-server systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 21 13:33:28 ubunto-server systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 21 13:33:28 ubunto-server systemd[1]: Failed to start The Apache HTTP Server.

in most cases this is a problem because you are running.. nginx

if you stop nginx with the command

sudo /etc/init.d/nginx stop