Cannot define multiple Listeners on the same IP:port

the hard part for me is that httpd.conf is only 539 lines... (according to vi)

My domain is:
galacticamc.xyz

I ran this command:
# certbot install --cert-name galacticamc.xy

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Unable to read ssl_module file; not disabling session tickets.
Deploying certificate
Successfully deployed certificate for galacticamc.xyz to /usr/local/etc/apache24/extra/httpd-ssl.conf
Successfully deployed certificate for www.galacticamc.xyz to /usr/local/etc/apache24/extra/httpd-vhosts-le-ssl.conf
Error while running apachectl configtest.
Performing sanity check on apache24 configuration:

AH00526: Syntax error on line 541 of /usr/local/etc/apache24/httpd.conf:
Cannot define multiple Listeners on the same IP:port

We were unable to install your certificate, however, we successfully restored your server to its prior configuration.
Error while running apachectl configtest.
Performing sanity check on apache24 configuration:

AH00526: Syntax error on line 541 of /usr/local/etc/apache24/httpd.conf:
Cannot define multiple Listeners on the same IP:port

My web server is (include version):
apache24

The operating system my web server runs on is (include version):
FreeBSD 12.2

My hosting provider, if applicable, is:
n/a

I can login to a root shell on my machine (yes or no, or I don't know):
yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
certbot 1.18.0

Please show this file:

1 Like

not sure if its relevant, but that file has "Listen 80" in it, and I also have /usr/local/etc/apache24/extra/httpd-ssl.conf, which contains "Listen 443".

I also have /usr/local/etc/apache24/extra/httpd-vhosts.conf, which does not contain a "Listen" line...

That file has only 540 lines - LOL
Let's have a look for listens in the included files:
grep -Ri listen /usr/local/etc/apache24/

1 Like

The paths seem inconsistent:

Include /usr/local/etc/apache24/extra/httpd-vhosts.conf
Include etc/apache24/extra/proxy-html.conf
Include etc/apache24/extra/httpd-ssl.conf
Include etc/apache24/Includes/*.conf

Please also show the output of:
sudo apachectl -t -D DUMP_VHOSTS

3 Likes

Output below. BTW, not sure if this is relevant but this is running in a jail. Regarding the inconsistency, i was under the impression that without the leading /, the path was relative to some root, and ServerRoot is "/usr/local", so i thought that was supposed to work but i don;t actualy know that 100%...... but i am changing all the "etc/apache24" to "/usr/local/etc/apache24" and will let you know if there is any difference.

root@piwigo:~ # grep -Ri listen /usr/local/etc/apache24/
/usr/local/etc/apache24/extra/httpd-ssl.conf.backup:# When we also provide SSL we have to listen to the
/usr/local/etc/apache24/extra/httpd-ssl.conf.backup:Listen 443
/usr/local/etc/apache24/extra/httpd-ssl.conf:# When we also provide SSL we have to listen to the
/usr/local/etc/apache24/extra/httpd-ssl.conf:Listen 443
/usr/local/etc/apache24/extra/httpd-ssl.conf.sample:# When we also provide SSL we have to listen to the
/usr/local/etc/apache24/extra/httpd-ssl.conf.sample:Listen 443
/usr/local/etc/apache24/httpd.conf.sample:# Listen: Allows you to bind Apache to specific IP addresses and/or
/usr/local/etc/apache24/httpd.conf.sample:# Change this to Listen on specific IP addresses as shown below to
/usr/local/etc/apache24/httpd.conf.sample:#Listen 12.34.56.78:80
/usr/local/etc/apache24/httpd.conf.sample:Listen 80
/usr/local/etc/apache24/httpd.conf:# Listen: Allows you to bind Apache to specific IP addresses and/or
/usr/local/etc/apache24/httpd.conf:# Change this to Listen on specific IP addresses as shown below to
/usr/local/etc/apache24/httpd.conf:#Listen 12.34.56.78:80
/usr/local/etc/apache24/httpd.conf:Listen 80
root@piwigo:~ #

root@piwigo:~ # apachectl -t -D DUMP_VHOSTS
VirtualHost configuration:
*:80 galacticamc.xyz (/usr/local/etc/apache24/extra/httpd-vhosts.conf:23)
*:443 galacticamc.xyz (/usr/local/etc/apache24/extra/httpd-ssl.conf:121)
root@piwigo:~ #

interesting, so i guess there was some mixup with the include files' directories? After changing all Includes to use the absolute path "/usr/local/etc/apache24", instead of the relative path "etc/apache24" the "multiple Listeners" error went away and the certificates deploy successfully.... thank you! i dont know if i ever would have thought of that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.