重新启动 apache (安装 trac 和 mod_wsgi)时,“ make_sock: 无法绑定到 address [ : : ] : 443”

我正在尝试通过 SSL 安装 trac 和 mod _ wsgi。我试着手动安装,但是效果不是很好,所以我开始按照下面的步骤: Trac-on-ubuntu

我跳过了 svn 部分,因为我想改用 git:

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


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

我重新启动 apache 只是为了得到这个错误:

* Restarting web server apache2


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


[ OK ]

做这些没有任何意义。

 netstat -anp | grep 443
fuser 443/tcp

这样做除了我运行的 grep 命令之外没有产生任何结果:

ps -aux | grep httpd

为什么它说有别的东西正在使用端口,而实际上什么也没有显示出来?

编辑: 你们会笑话这个的。我有一个额外的监听443在港口。 conf,这不应该在那里。移除那个解决了这个问题。

149936 次浏览

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.

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 :)

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

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

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.

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).

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

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

In httpd.conf instead:

Listen *:443

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

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

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.

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.

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