0

Using Apache2 on Linux, I get this error message when trying to start it.

$ sudo /usr/local/apache2/bin/apachectl start

httpd not running, trying to start
(98)Address already in use: make_sock: unable to listen for connections on address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs

$ sudo /usr/local/apache2/bin/apachectl stop

httpd (no pid file) not running

Some facts:

  • This is one of the last lines in my Apache logs:

    [Mon Jun 19 18:29:01 2017] [warn] pid file /usr/local/apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?

  • My '/usr/local/apache2/conf/httpd.conf' contains Listen 127.0.0.1:80

  • I have "Listen 80" configured at '/etc/apache2/ports.conf'

  • Disk is not full

  • I've checked that I do not have two or more "Listen" at '/usr/local/apache2/conf/httpd.conf'

Some outputs:

$ sudo ps -ef | grep apache

root      1432     1  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1435  1432  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1436  1432  0 17:35 ?        00:00:00 /usr/sbin/apache2 -k start
myuserr   1775  1685  0 17:37 pts/1    00:00:00 grep --color=auto apache

$ sudo grep -ri listen /etc/apache2

/etc/apache2/apache2.conf:#   supposed to determine listening ports for incoming connections which can be
/etc/apache2/apache2.conf:# Include list of ports to listen on
/etc/apache2/ports.conf:Listen 80
/etc/apache2/ports.conf:    Listen 443
/etc/apache2/ports.conf:    Listen 443

What can I do to restart Apache? Should I repair 'httpd.pid'?

Hookstark
  • 1,097
  • 3
  • 11
  • 23

2 Answers2

0

This error means that something already uses 80 port. If you really don't have 2 line of Listen 80 in apache configurations then execute this command to see what uses 80 port: netstat -antp | grep 80.

0

I fixed it by killing the three processes

root      1621     1  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1624  1621  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1625  1621  0 18:46 ?        00:00:00 /usr/sbin/apache2 -k start

However, each time I want to reboot my server, I must kill thee processes. What is starting them?

Hookstark
  • 1,097
  • 3
  • 11
  • 23