"make_sock: could not bind to address [::]:443" when restarting apache (installing trac and mod_wsgi)
Asked Answered
B

13

100

I'm trying to install trac and mod_wsgi over SSL. I tried to manually install it, but that didn't work out so well so I started to follow this: trac-on-ubuntu

I skipped the svn part because I'd like to use git instead. After the first edit of httpd.conf:

WSGIScriptAlias /trac /var/trac/apache/trac.wsgi

<Directory /var/trac/apache>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>

I restarted apache only to get this error:

* Restarting web server apache2                                                    

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

                                                                     [ OK ]

Doing these showed nothing.

 netstat -anp | grep 443 
 fuser 443/tcp

Doing this didn't yield anything except the grep command that I ran:

ps -aux | grep httpd

Why is it saying that something else is using the port when there's nothing showing up?

EDIT: You guys are going to laugh at this. I had an extra Listen 443 in ports.conf that shouldn't have been there. Removing that solved this.

Bethlehem answered 4/2, 2012 at 19:47 Comment(5)
Good you found the extra Listen statement. Was going to suggest just that as possible cause until I got to your edit. :-)Nard
You may want to re-write your edit into an answer and accept it. This is the recommended way to mark a question as "solved" and not needing much more support.Mezereum
Unfortunately, I have this problem, but an extra "Listen 443" is not the cause...Quarters
I had exactly the same problem. Removed the top most 443 from ports.conf, restarted apache2 and it all worked.Diablerie
8 years later and another individual that doesn't want to mention his name coming across this problem. And of course 8 years later searching for the error message you land on stack overflow. Thats why i just had to ad a message ;)Ichthyo
B
241

You guys are going to laugh at this. I had an extra Listen 443 in ports.conf that shouldn't have been there. Removing that solved this.

Bethlehem answered 28/4, 2012 at 21:46 Comment(9)
I updated apache with YUM, and it created a new ssl.conf file with another listen 443....Amerind
Thank you... Some day, I hope for a webserver as widely deployed as apache that isn't a convoluted headache to configureWatchword
In my case, an upgrade of httpd on Centos caused reinstallation of ssl.conf... but we declare Listen 443 in a different config file. Puppet removes ssl.conf... but puppet runs under passenger/httpd. So puppet agent never got the chance to remove the ssl.conf, so there were 2 Listen 443 directives, as described here.Stroh
Thank you, in /etc/httpd/conf.d/ssl.conf then I remove from <VirtualHost default:443> ... </VirtualHost> and apache works fineBackswept
In my case was a different file location, but in general is the same issue, duplicate Listen 443. You should find any duplicate line "Listen 443" in any apache conf file. To be exact, you should not have "Listen 443" in two or more file.Milt
I had the exact same issue with CentOS 7. Nice one :)Dracula
/etc/apache2/ports.confAraiza
I ran certbot, which inserted another 443 entry in my config file. Thanks!Yes
I had the same issue on Apache 2.4.7 (Ubuntu 14.04.5), but the same configuration did not give me any trouble on another machine with Apache 2.4.18 (Ubuntu 16.04.4)Endosperm
A
22

Thank you for you answers, on apache 2.4.x versions if have installed ssl_module using yum command, dont want to add the port :443 in httpd.conf (main) file,

To find out the port 443 in configure files,

# grep '443' /etc/httpd/conf.d/*

/etc/httpd/conf.d/ssl.conf:Listen 443 https
/etc/httpd/conf.d/ssl.conf:<VirtualHost _default_:443>
/etc/httpd/conf.d/ssl.conf:#ServerName www.example.com:443

# grep '443' /etc/httpd/conf/httpd.conf 
Listen 443

Just remove the line or command it (Listen 443) from httpd.conf file.

Acidulant answered 13/7, 2015 at 6:48 Comment(1)
This did the trick! In my case, that error appeared after a yum update :-PPrefer
F
16

I'm adding another answer to this as I had the same problem and solved it the same way: I had installed SSL on apache2 using a2enmod ssl, which seems to have added an extra configuration in /etc/apache2/ports.conf:

NameVirtualHost *:80
Listen 80

NameVirtualHost *:443
Listen 443

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

I had to comment out the first Listen 443 after the NameVirtualHost *:443 directive:

NameVirtualHost *:443
#Listen 443

But I'm thinking I can as well let it and comment the others. Anyway, thank you for the solution :)

Fervent answered 14/6, 2013 at 5:46 Comment(0)
A
4

For everyone else who has no duplicate Listen directives and no running processes on the port: check that you don't accidentally include ports.conf twice in apache2.conf (as I did due to a bad merge).

Andrej answered 30/7, 2016 at 12:2 Comment(0)
A
3

I am using Ubuntu. I just disabled ssl mode of apache2 and it worked for me.

a2dismod ssl

and then restarted apache2.

service apache2 restart
Audriaaudrie answered 27/11, 2013 at 5:55 Comment(0)
W
3

I use apache version 2.4.27, also have this problem, solved it through modify

the conf/extra/httpdahssl.conf,comment the 18 line content(Listen 443 https),it works fine.

Wreath answered 9/8, 2017 at 7:6 Comment(1)
Are you able to use https if you comment this line?Jasper
R
2

I made the mistake of incorrectly naming a backup file in the /etc/httpd/conf.d directory. In the README it states that it alphabetically goes through all .conf files.

I had created ssl-<date>.conf (meant to be a backup) and it was loading before ssl.conf. It was binding the :443 port based on the ssl-<date>.conf and failing on the ssl.conf.

Once I renamed the backup file to ssl.conf.<date>, the service started without issue.

As a note, the server I'm on is running RHEL 6

Resuscitate answered 29/6, 2017 at 13:42 Comment(3)
Something like this happened to me, so I thought I'd mention it in case it helps someone. I renamed ssl.conf so I could remember that it was set up to use letsencrypt. Later, I allowed what I thought was a minor update to Apache to happen. That update put ssl.conf back in conf.d, creating the conflict in Listen statements. Not sure what to do about this except be vigilant. If I'd stuck with the default ssl.conf filename, the update probably would have clobbered it!Lota
I have done the same thing and Apache couldn't start. I had removed that back up file and it started working. Thank you very much for this answer, you are a life saver.Spacing
this is the answer!Vair
F
1

I seconded Matthieu answer

I commented #Listen 443 in httpd-ssl file and apache can be started

Because the file already has VirtualHost default:443

Firepower answered 18/5, 2017 at 17:23 Comment(0)
O
1

Let me add one more reason for the error. In httpd.conf I included explicitly

Include etc/apache24/extra/httpd-ssl.conf

while did not notice previous wildcard

Include etc/apache24/extra/*.conf

Grepping 443 will not find this.

Osteopath answered 25/6, 2018 at 14:35 Comment(0)
B
1

I had same issue, was due to multiple copies of ssl.conf In /etc/httpd/conf.d - There should only be one.

Braxton answered 6/12, 2019 at 16:6 Comment(2)
Sorry to say, but this is a comment, not an answer. If you have more informations about the solution what you have found out about the case, please let us know.Nugget
The real explaination is more multiple "Listen 443" present in differents ssl.conf than the differents config files. Removing only the "Listen 443" solve the issue.Influenza
T
0

I have checked and fixed the following and got it resolved -

  1. httpd.conf file at /etc/httpd/conf/
  2. Checked the listening IP and port e.g. 10.12.13.4:80
  3. Removed extra listening port(s)
  4. Restarted the httpd service to take
Trireme answered 24/7, 2014 at 11:12 Comment(0)
A
0

I meet the problem in windows7, phpeclipse, when I start the XAMPP. My solution is :

  • 1.Commented out the \xampp\apache\conf\httpd.conf -> line171 -> #LoadModule ssl_module modules/mod_ssl.so

  • 2.line539 -> #Include conf/extra/httpd-ssl.conf

or you can change the 443 port to another one

Agrippina answered 11/5, 2017 at 8:0 Comment(0)
W
0

In httpd.conf instead:

Listen *:443

you need write Listen 127.0.0.1:443 It works for me.

Wilderness answered 4/6, 2017 at 15:21 Comment(1)
You would only use 127.0.0.1 in a listen statement if you wanted to restrict acceptance of connections to the local host loop back interface only. Removal of duplicate Listen statement as stated by many is the more typical solution. If you had duplicates, on *:443, then changing one to use 127.0.0.1 shouldn't really have made a difference as the other *:443 would still try and bind same port on 127.0.0.1.Nard

© 2022 - 2024 — McMap. All rights reserved.