0

I'm getting this error when trying to start apache on a new Centos 7 VPS server.

httpd[1297]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443

The thing is, virtually nothing is running.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0 194784  3544 ?        Ss   03:51   0:00 init -z
root         2  0.0  0.0      0     0 ?        S    03:51   0:00 [kthreadd/219]
root         3  0.0  0.0      0     0 ?        S    03:51   0:00 [khelper/219]
root        64  0.0  0.1  85220  7820 ?        Ss   03:51   0:00 /usr/lib/systemd/systemd-journald
root        70  0.0  0.0  41568  1724 ?        Ss   03:51   0:00 /usr/lib/systemd/systemd-udevd
root       104  0.0  0.0  11076   988 ?        Ss   03:51   0:00 /usr/bin/rsync --daemon --no-detach
root       106  0.0  0.0  26328  1676 ?        Ss   03:51   0:00 /usr/lib/systemd/systemd-logind
dbus       107  0.0  0.0  58032  2264 ?        Ss   03:51   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       119  0.0  0.0  22696  1528 ?        Ss   03:51   0:00 /usr/sbin/crond -n
root       124  0.0  0.0   6452   816 tty1     Ss+  03:51   0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
root       126  0.0  0.0   6452   816 tty2     Ss+  03:51   0:00 /sbin/agetty --noclear tty2 linux
rpc        127  0.0  0.0  69172  1136 ?        Ss   03:51   0:00 /sbin/rpcbind -w
root       370  0.0  0.1 112764  4320 ?        Ss   03:51   0:00 /usr/sbin/sshd -D
root       377  0.0  0.1 258460  5684 ?        Ssl  03:51   0:00 /usr/sbin/rsyslogd -n
root       795  0.0  0.1 150452  5508 ?        Ss   03:52   0:00 sshd: root@pts/0
root       797  0.0  0.0  11900  2064 pts/0    Ss   03:52   0:00 -bash
root      1307  0.0  0.0  51660  1708 pts/0    R+   04:00   0:00 ps auxwwww

Nothing is already listening on port 443

lsof -i

COMMAND PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
rsync   104 root    4u  IPv4 24457457      0t0  TCP *:rsync (LISTEN)
rsync   104 root    5u  IPv6 24457458      0t0  TCP *:rsync (LISTEN)
rpcbind 127  rpc    6u  IPv4 24457493      0t0  UDP *:sunrpc 
rpcbind 127  rpc    7u  IPv4 24457494      0t0  UDP *:iris-beep 
rpcbind 127  rpc    8u  IPv4 24457495      0t0  TCP *:sunrpc (LISTEN)
rpcbind 127  rpc    9u  IPv6 24457496      0t0  UDP *:sunrpc 
rpcbind 127  rpc   10u  IPv6 24457497      0t0  UDP *:iris-beep 
rpcbind 127  rpc   11u  IPv6 24457498      0t0  TCP *:sunrpc (LISTEN)
sshd    370 root    3u  IPv4 24458438      0t0  TCP *:infolibria (LISTEN)
sshd    370 root    4u  IPv6 24458447      0t0  TCP *:infolibria (LISTEN)

Changing the port to 444 or 4444 gives the same can't bind error. I created a new self signed cert for this host.

Running httpd with -e debug shows all of the modules being loaded then the error. Nothing helpful and nothing in between. I'm out of ideas. I'm using the default ssl.conf with only the path to the cert changed. If I remove the ssl.conf file or comment out the Listen directive in it apache will start but obviously doesn't listen for SSL.

  • 1
    maybe some process are hanged. try # killall httpd and try to start service. Also check syntax once # apachectl configtest – Sunil Bhoi Jul 5 '18 at 5:02
  • 2
    1. ps and lsof are the wrong tools for checking this. ss -t -a -n is better. – Jenny D Jul 5 '18 at 5:14
  • 3
    2. The error may simply be that you are having more than one Listen line in your http config, so that Apache tries to bind the same port more than once. Please include your config if you want any help with apache. – Jenny D Jul 5 '18 at 5:15
  • Also you can try netstat, like this: netstat -ap | grep LISTEN – warder Jul 5 '18 at 7:58
  • Syntax is ok from apachectl configtest – Sym Jul 5 '18 at 11:05
0

There is a chance that you are having two listener configs with same port in your config files.

Try a grep to your config files.

Example: grep -r "Listen 443" /etc/apache2

Change the port number and the config location accordingly.

Reference: https://stackoverflow.com/questions/9143964/make-sock-could-not-bind-to-address-443-when-restarting-apache-installi

  • Did that but only the one 443 directive was found. Changed that to 444, same error. I think it has to be something with the host system. Copied the exact same configs to a different server and apache worked as expected. – Sym Jul 6 '18 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.