How can I start apache2 from error code=exited status=1

August 26, 2019 161 views
Apache Linux Commands Ubuntu

Im a web developer and im new in Ubuntu, I have days trying to install apache2 to work with php.
But I always get this error starting Apache2:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● 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 Mon 2019-08-26 01:23:22 CDT; 29ms ago
  Process: 8725 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: 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
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: no listening sockets available, shutting down
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: AH00015: Unable to open logs
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: Action 'start' failed.
ago 26 01:23:22 alejandro-TP201SA apachectl[8725]: The Apache error log may have more information.
ago 26 01:23:22 alejandro-TP201SA systemd[1]: apache2.service: Control process exited, code=exited status=1
ago 26 01:23:22 alejandro-TP201SA systemd[1]: apache2.service: Failed with result 'exit-code'.
ago 26 01:23:22 alejandro-TP201SA systemd[1]: Failed to start The Apache HTTP Server.
Procesando disparadores para ureadahead (0.100.0-21) …
Procesando disparadores para systemd (237-3ubuntu10.25) …
Procesando disparadores para man-db (2.8.3-2ubuntu0.1) …
Procesando disparadores para ufw (0.36-0ubuntu0.18.04.1) …
sh: 0: getcwd() failed: No such file or directory

I’ve tried to reinstall apache, but it hasn’t work for me…
Does anyone know what can i do? It would be very helpful.
Thanks

1 Answer

Hello,

The problem is that you have another service listening on port 80 already. You can not have 2 services listening on the same port at the same time.

To find out which service is using the port you could run this command:

netstat -plant | grep 80

Then if you do not need this service you could stop it and disable it so that it does not start on boot.

After that you should be able to start Apache as normal.

Hope that this helps!
Regards,
Bobby

Have another answer? Share your knowledge.