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?

edited by MattIPv4

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.

×
1 answer

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

  • Hi @rulet,

    Please excuse me for the follow up. I just forgot to mention a couple of other stuff.

    So, I mentioned in case there is a service on port 80 you’ll need to edit the configuration of the said service and change the port. This is only in case you want Apache to listen on port 80 which would be normal. Port 80 is the port number assigned to commonly used internet communication protocol, Hypertext Transfer Protocol (HTTP). It is the port from which a computer sends and receives Web client-based communication and messages from a Web server and is used to send and receive HTML pages or data.

    Additionally, if this isn’t the case you’ll need to check either the apache error log which is located

    • RHEL / Red Hat / CentOS / Fedora Linux Apache access file location – /var/log/httpd/error_log.
    • Debian / Ubuntu Linux Apache access log file location – /var/log/apache2/error_log.

    Or your server’s Journal by typing in just after an Apache restart

    journalctl -xe
    

    Regards,
    KDSys

    • The thing is that nginx server uses port 80:

      r1@prime:~$ sudo netstat -tulpn | grep :80
      [sudo] пароль для r1:
      tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 736/nginx: master p
      tcp6 0 0 :::80 :::* LISTEN 736/nginx: master p

      Is it possible to use simultaneously apache and nginx servers. If yes, if I understand right do I have to assign nginx to another port, and if yes, how to do that?

Submit an Answer