strange behaviour 15.4 apache2 server

Hello everybody.

I have strange behaviour on my opensuse 15.4 apache2 server. The service doesn’t start and gives back:

Sep 25 10:46:14 shuttloj start_apache2[29548]: AH00526: Syntax error on line 16 of /etc/apache2/listen.conf:
Sep 25 10:46:14 shuttloj start_apache2[29548]: Cannot define multiple Listeners on the same IP:port

Sounds simple enough, but isn’t because the configs show only 1 connection :frowning:

I have uploaded the error description with the usual information on
https://susepaste.org/53635950
https://susepaste.org/99816333
https://susepaste.org/80669787

Is there anyone willing to look at my problem and tell me what is wrong please? Thanks much appreciated

I have already talked to the guys on libera.chat #httpd but the one who talked to me couldn’t help me

What about that:

Syntax error on line 16 of /etc/apache2/listen.conf:

But where is the mistake?
It is like any other Listen statement, just like in the example that was written there before. I just can’t see the error

See line 13:

Listen directives: “Listen ::]:443” and “Listen 0.0.0.0:443”

it says in the help files that you should change the address to your host’s address to avoid listening to all interfaces, which I have done …

Somewhere in your configuration files you have an additional setting for this IP/port. What about your /etc/apache2/default-server.conf?

You should try the apache internal config checker to find the issue with your config (will possibly be more verbose):
https://www.digitalocean.com/community/tutorials/apache-configuration-error-ah00526-syntax-error#troubleshooting-with-apachectl

I have uploaded the contents of this file here: https://susepaste.org/55844187
There is nothin in there as far as i can see.

apachectl configtest
<CODE>AH00526: Syntax error on line 16 of /etc/apache2/listen.conf:
Cannot define multiple Listeners on the same IP:port</CODE>

Your /etc/apache2/virtualhosts.conf contains also *:80

yes, true, but that is the only server, and I can’t go without that, i need to state that in virtualhosts.conf, don’t I? (I don’t have a default server, i want to install more than one virtual servers, namebased, but I have deleted them in virtualhosts.conf temporarily, to simplify it and find the mistake)

Sorry i’m not that expert at Apache, but i believe it has something to do with your listen configuration and your virtualhost config. There are some hints in the apache documentation which may help:
https://httpd.apache.org/docs/2.4/en/bind.html

How This Works With Virtual Hosts

The Listen directive does not implement Virtual Hosts - it only tells the main server what addresses and ports to listen on. If no <VirtualHost>](core - Apache HTTP Server Version 2.4) directives are used, the server will behave in the same way for all accepted requests. However, <VirtualHost>](core - Apache HTTP Server Version 2.4) can be used to specify a different behavior for one or more of the addresses or ports. To implement a VirtualHost, the server must first be told to listen to the address and port to be used. Then a <VirtualHost>](core - Apache HTTP Server Version 2.4) section should be created for the specified address and port to set the behavior of this virtual host. Note that if the <VirtualHost>](core - Apache HTTP Server Version 2.4) is set for an address and port that the server is not listening to, it cannot be accessed.

https://httpd.apache.org/docs/2.4/en/mod/mpm_common.html#listen

https://httpd.apache.org/docs/2.4/vhosts/examples.html

Thanks, that seems interesting indeed. i have tried that, changing it to
<VirtualHost 192.168.2.38:80>
in /etc/apache2/virtualhosts.conf

but strill no change.

So, listen.conf says: listen to 192.168.2.38:80

and virtualhosts.conf says:
<VirtualHost 192.168.2.38:80>

can that be wrong?

Show output of “grep -ri listen /etc/apache2”. And no, it is not the same command you used already.

grep -ri listen /etc/apache2

/etc/apache2/listen.conf:# Listen: Allows you to bind Apache to specific IP addresses and/or
/etc/apache2/listen.conf:# https://httpd.apache.org/docs/2.4/mod/mpm_common.html#listen
/etc/apache2/listen.conf:# Change this to Listen on specific IP addresses as shown below to
/etc/apache2/listen.conf:# When we also provide SSL we have to listen to the
/etc/apache2/listen.conf:# Listen directives: “Listen ::]:443” and “Listen 0.0.0.0:443”
/etc/apache2/listen.conf:Listen 192.168.2.38:80
/etc/apache2/listen.conf:# Listen 443
/etc/apache2/httpd.conf:# |-- listen.conf . . . . . . . . . . . . . IP adresses / ports to listen on
/etc/apache2/httpd.conf:# |-- listen.conf
/etc/apache2/httpd.conf:# IP addresses / ports to listen on
/etc/apache2/httpd.conf:Include /etc/apache2/listen.conf

OK, it sounded like listen.conf was included multiple times.

What is the content of /etc/sysconfig/apache2? And please, put computer output in tags [noparse]

...

[/noparse]

Thanks for helping.

Content of /etc/sysconfig/apache2 is here:
https://susepaste.org/43148619

looks unconspicuous to me.

APACHE_CONF_INCLUDE_FILES="/etc/apache2/httpd.conf"

httpd.conf (and hence listen.conf) is included twice. httpd.conf is already processed by default unless changed in APACHE_HTTPD_CONF.

ah ok, I see, so shall I comment that one out in /etc/sysconfig/apache2 ?

I’ll try and let you know. Thanks for the tip

Yep, thanks a lot!! This was the problem!

Apache2 is started now. Great!
(not my fault, though, I don’t know why the config is included twice by default, I haven’t done that myself.

So, for anyone with the same problem. When you do :

       systemctl  start httpd

or
apachectl -S
and this comes:

 AH00526: Syntax error on line 16 of /etc/apache2/listen.conf:Cannot define multiple Listeners on the same IP:port 

… but /etc/apache2/listen.conf and httpd.conf have together only one “Listen” Directive, and you are wondering where the “multiple listeners” come from,
then look in /etc/sysconfig/apache2 and see if httpd.conf is loaded from there as well, because it will be loaded anyway, and thus fail on double loading the Listen directive

Thanks !