4

I've just updated Apache to 2.4.3 on my AWS instance (running Linux AMI). After the update finished, Apache crashed with the following:

Starting httpd: AH00526: Syntax error on line 5 of /etc/httpd/conf.d/ssl.conf:
Cannot define multiple Listeners on the same IP:port

I went into the above file and commented out line 5: #Listen 443, because the new httpd.conf contains a line where the above listener is already set:

httpd.conf:

 40 ...
 41 #Listen 12.34.56.78:80
 42 Listen 80
 43 Listen 443
 44 
 45 ...

My question is, if I configure SSL certificates individually in my VirtualHost's config files, could I just comment out every line in the httpd/conf.d/ssl.conf? I mean is it still important to have it included? And why Apache 2.4.3 sets Listen 443 twice?

Thanks!

Edmond Tamas
  • 211
  • 1
  • 3
  • 7
  • 1
    Perhaps, during the upgrade, an old configuration file wasn't removed because of changes that were made to it since the previous version was installed? – Gerard H. Pille Sep 26 '18 at 11:03
  • @GerardH.Pille The same happened to me when I migrated Debian versions that upgraded Apache. It is indeed a matter of conflict between configuration files of different Apache versions. – Rui F Ribeiro Sep 26 '18 at 12:12
  • @RuiFRibeiro In your case, it wasn't because you'd changed config files? – Gerard H. Pille Sep 26 '18 at 12:46
  • @GerardH.Pille To put it simply, yeah. That server was already a migration from something more older. – Rui F Ribeiro Sep 26 '18 at 13:21
  • @GerardH.Pille yes, the old config file wasn't removed, probably this was the reason of the conflict. And regarding my second question, is the `httpd/conf.d/ssl.conf` needed if I use to configure SSL in my VirtualHost's config files? – Edmond Tamas Sep 26 '18 at 18:27
  • 1
    Needed, no, but you could use it for those settings valid for all VH's. – Gerard H. Pille Sep 26 '18 at 20:02

2 Answers2

3

I have got the same error on different file

AH00526: Syntax error on line 18 of /private/etc/apache2/other/httpd_xcs.conf:
Cannot define multiple Listeners on the same IP:port

I just comment #Listen 443 and it worked fine.

AsimRazaKhan
  • 131
  • 4
2

I had this problem under Windows 10 Server with Apache 2.4 installation. Problem ist that there's only one port-binding allowed.

The default httpd.conf has at the end the following section:

<IfModule ssl_module>
Listen 443
Include conf/extra/httpd-ssl.conf
Include conf/extra/httpd-ahssl.conf
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<IfModule http2_module>
    ProtocolsHonorOrder On
    Protocols h2 h2c http/1.1
</IfModule>

As you can see there's one port-binding at the second line and two other Listen 443 in the conf/extra/httpd-ssl.conf and conf/extra/httpd-ahssl.conf.

You can either comment out the corresponding port-binding in the httpd.conf or inside the included config files.