(48)Address already in use: make_sock: could not bind to add

Hi
Until this morning all was fine with my webserver set-up, now I got problems. It all stemmed from me trying to restart Apache, with the server reporting:
Code:
Syntax OK
Starting apache22.
(48)Address already in use: make_sock: could not bind to address ip.ip.ip.ip:80
no listening sockets available, shutting down
Unable to open logs
/usr/local/etc/rc.d/apache22: WARNING: failed to start apache22

I thought to myself, If Apache can't bind to address ip.ip.ip.ip then why not try to remove this obstacle from my config files. So, In:
httpd-ssl.conf and httpd.conf I changed

Code:
Listen ip.ip.ip.ip:80
to
Code:
Listen 80
I then attempt to restart Apache and sure enough, it restarts but none of my websites display in the browser - with the page just hanging indefinitely? Here's today's httpd-error.log records:

Code:
[Fri Jan 24 06:32:08 2014] [notice] caught SIGTERM, shutting down
[Fri Jan 24 07:08:51 2014] [error] Init: Private key not found
[Fri Jan 24 07:08:51 2014] [error] SSL Library Error: 218710120 error:0D094068:asn1 encoding routines:d2i_ASN1_SET:bad tag
[Fri Jan 24 07:08:51 2014] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Fri Jan 24 07:08:51 2014] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
[Fri Jan 24 07:08:51 2014] [error] SSL Library Error: 218734605 error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib
[Fri Jan 24 08:03:46 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 24 08:03:46 2014] [notice] Digest: done
[Fri Jan 24 08:03:47 2014] [notice] Apache/2.2.25 (FreeBSD) PHP/5.4.16 mod_ssl/2.2.25 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
[Fri Jan 24 08:13:11 2014] [notice] caught SIGTERM, shutting down
[Fri Jan 24 08:18:33 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 24 08:18:33 2014] [notice] Digest: done
[Fri Jan 24 08:18:34 2014] [notice] Apache/2.2.25 (FreeBSD) PHP/5.4.16 mod_ssl/2.2.25 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
[Fri Jan 24 08:27:01 2014] [notice] caught SIGTERM, shutting down
[Fri Jan 24 08:27:13 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 24 08:27:13 2014] [notice] Digest: done
[Fri Jan 24 08:27:14 2014] [notice] Apache/2.2.25 (FreeBSD) PHP/5.4.16 mod_ssl/2.2.25 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
[Fri Jan 24 08:37:10 2014] [notice] caught SIGTERM, shutting down
[Fri Jan 24 08:37:19 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 24 08:37:19 2014] [notice] Digest: done
[Fri Jan 24 08:37:20 2014] [notice] Apache/2.2.25 (FreeBSD) PHP/5.4.16 mod_ssl/2.2.25 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
[Fri Jan 24 09:03:08 2014] [notice] caught SIGTERM, shutting down
[Fri Jan 24 09:03:13 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 24 09:03:13 2014] [notice] Digest: done
[Fri Jan 24 09:03:14 2014] [notice] Apache/2.2.25 (FreeBSD) PHP/5.4.16 mod_ssl/2.2.25 OpenSSL/0.9.8q DAV/2 configured -- resuming normal operations
 
Re: (48)Address already in use: make_sock: could not bind to

Stop Apache, wait a couple of seconds and then check if there's anything else still locking port 80 with sockstat -46. It may just be some Apache process that's hung up and keeping the port bound.
 
Re: (48)Address already in use: make_sock: could not bind to

SirDice said:
Stop Apache, wait a couple of seconds and then check if there's anything else still locking port 80 with sockstat -46. It may just be some Apache process that's hung up and keeping the port bound.

Thanks. I order that command and see an entry with port:80 in it:

Code:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     httpd      1552  3  tcp4   ip.ip.ip.ip:80      *:*

Is this the problem? What should I do? kill pid 1552
 
Re: (48)Address already in use: make_sock: could not bind to

Yes, if you stopped Apache this process is probably stuck. Try killing it, kill 1552 or kill it hard: kill -9 1552.
 
Re: (48)Address already in use: make_sock: could not bind to

SirDice said:
Yes, if you stopped Apache this process is probably stuck. Try killing it, kill 1552 or kill it hard: kill -9 1552.

Nice, everything's back-up - kill it hard! :) Many thanks.
 
I've just had the same problem starting Apache24 in a FreeNAS jail following a power cut. But the same solution doesn't work for me...

Code:
root@FreeBSD:~ # sockstat -46
sockstat: struct xtcpcb size mismatch
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     syslogd    6036  6  udp6   *:514                 *:*
root     syslogd    6036  7  udp4   *:514                 *:*

Any advice?
 
Back
Top