Question

Can't start apache server

Error when trying to reload:

r1@prime:~$ sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-11-25 01:04:32 EET; 47min ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 5392 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

ноя 25 01:04:32 prime apachectl[5392]: no listening sockets available, shutting down
ноя 25 01:04:32 prime apachectl[5392]: AH00015: Unable to open logs
ноя 25 01:04:32 prime apachectl[5392]: Action 'start' failed.
ноя 25 01:04:32 prime apachectl[5392]: The Apache error log may have more information.
ноя 25 01:04:32 prime systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
ноя 25 01:04:32 prime systemd[1]: apache2.service: Failed with result 'exit-code'.
ноя 25 01:04:32 prime systemd[1]: Failed to start The Apache HTTP Server.
ноя 25 01:04:35 prime systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
ноя 25 01:16:54 prime systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
ноя 25 01:42:04 prime systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
r1@prime:~$

How to fix it?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @rulet,

Looking at the provided status, the error can be explained here

ноя 25 01:04:32 prime apachectl[5392]: no listening sockets available, shutting down

This would suggest Apache can’t start as something else is listening on the ports it’s supposed to. Usually Apache listens on port 80 so you’ll need to first check what is actually listening on it.

To do so, you’ll just need to enter this command

netstat -tulpen | grep 80

This will result in a similar ouput

netstat -tulpen | grep 80
tcp6       0      0 :::80                   :::*                    LISTEN      0          22984337   516/httpd  

In this case, Apache is actually properly running however in your cases something else would be listening on that port.

You’ll need to turn off the service that’s listening on the port. Edit it’s configuration to use another port and restart Apache.

That should be it.

Regards, KDSys