0

I'm unable to run sudo service apache2 restart on my sever. Inorder to troubleshoot this when I execute sudo systemctl status apache2.service and I get the following log.

   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 Sat 2019-12-07 13:04:25 UTC; 7min ago
  Process: 17357 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

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

How can I resolve this issue ?

NOTE : the actual domain name is replaced with domainname.

2 Answers 2

1

Some other process is already using port 80. To find out what process it is do a

netstat -tulpen | grep 80

In the right column of the output you will see the name and id of the process blocking the port. In order to be able to start the apache2 service you have to stop (or kill) it.

2
  • what command do I use to kill the process
    – Rasik
    Dec 10, 2019 at 18:50
  • try killall apache2 or kill -9 <pid> where <pid> is the process id that you see in the netstat output.
    – digijay
    Dec 10, 2019 at 22:33
-1

# /etc/init.d/apache2 restart

OR $ sudo /etc/init.d/apache2 restart

OR $ sudo service apache2 restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .