Can’t start apache2 server

apache-2.2

I'm getting the following error message while starting apache2 server:

$ sudo /etc/init.d/apache2 start * Starting
web server apache2
(98)Address already in use: make_sock: could not bind to address
0.0.0.0:443 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more
information.
[fail]

Here is the output of sudo netstat -lntup:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:28017           0.0.0.0:*               LISTEN      941/mongod
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1355/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      687/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      854/cupsd
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      941/mongod
tcp6       0      0 :::22                   :::*                    LISTEN      687/sshd
tcp6       0      0 ::1:631                 :::*                    LISTEN      854/cupsd
udp        0      0 0.0.0.0:22543           0.0.0.0:*                           1049/dhclient
udp        0      0 127.0.1.1:53            0.0.0.0:*                           1355/dnsmasq
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1049/dhclient
udp        0      0 0.0.0.0:46027           0.0.0.0:*                           901/avahi-daemon: r
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           901/avahi-daemon: r
udp6       0      0 :::38743                :::*                                901/avahi-daemon: r
udp6       0      0 :::27403                :::*                                1049/dhclient
udp6       0      0 :::5353                 :::*                                901/avahi-daemon: r

Anyone knows why and how it should be fixed?

Thanks!!!

Best Answer

Apache gives this same error message when you have two Listen directives that target the same IP/port combination. The first one succeeds without error, the second one finds that something is already listening on that port and aborts.

It's not uncommon to find these directives in different files, such as vhost files or top-level files such as ports.conf or ssl.conf.

You can find them with grep -r Listen /etc/apache2 or grep -r Listen /etc/httpd depending on whether you are using a Debian-based distro or a RedHat-based distro.

Related Topic