Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 192821

Summary: www-servers/apache-2.2.6 double bind on 443 port...
Product: Gentoo Linux Reporter: Jiri Tyr <jiri.tyr>
Component: New packagesAssignee: Apache Team - Bugzilla Reports <apache-bugs>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: 2007.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 178966    
Bug Blocks:    

Description Jiri Tyr 2007-09-17 14:24:37 UTC
I have upgraded apache to version 2.2.6 and I have got problem with bind to 0.0.0.0:443 port:

 * Starting apache2 ...
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down

My /etc/conf.d/apache2 settings:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D USERDIR"

When I tried to strace command:

strace /usr/sbin/apache2 -- -D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D USERDIR -D FCGID -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf | grep 443

I have got this result:

bind(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
bind(4, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
write(2, "(98)Address already in use: make"..., 77(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443

So it tried to bind the same port twice. When I commented out "Listem 443" in /etc/apache2/vhosts.d/00_default_ssl_vhost.conf then it works. The second "Listem 443" is located in file /etc/apache2/modules.d/40_mod_ssl.conf. I suppose you should have only one "Listen 443" in all modules and vhosts.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2007-09-17 14:58:17 UTC
Did you run etc-update or dispatch-config?
Are you sure that no Apache processes are still running (even when the init.d script says they were shut down properly)?
Comment 2 Jiri Tyr 2007-09-17 15:09:13 UTC
(In reply to comment #1)
> Did you run etc-update or dispatch-config?

Yes, I did.

> Are you sure that no Apache processes are still running (even when the init.d
> script says they were shut down properly)?

Yes, I'm pretty sure that there is any other apache2 process running and any other socket doesn't use 443 port (netstat -nap --inet |grep 443 | grep LISTEN). The problem is really only in double "Listen 443" in configuration files.
Comment 3 Benedikt Böhm (RETIRED) gentoo-dev 2007-09-17 17:18:06 UTC
remove /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf (or migrate it to /etc/apache2/vhosts.d/ if you changed it [you shouldn't have changed it])
Comment 4 Jiri Tyr 2007-09-17 21:14:43 UTC
(In reply to comment #3)
> remove /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf (or migrate it to
> /etc/apache2/vhosts.d/ if you changed it [you shouldn't have changed it])

I have any /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf. I have just /etc/apache2/modules.d/40_mod_ssl.conf and this file is part of apache-2.2.6. In /etc/apache2/vhosts.d/ is only 00_default_ssl_vhost.conf, 00_default_vhost.conf and default_vhost.include. So there are still two files where is defined "Listen 443". I suppose there should be only one where it should be defined.
Comment 5 Benedikt Böhm (RETIRED) gentoo-dev 2007-09-18 05:50:19 UTC
this is our default config:

apache22t / # grep ^Listen -r /etc/apache2/
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:Listen 443
/etc/apache2/vhosts.d/00_default_vhost.conf:Listen 80

please check your custom configs