Re: Apache2 fails to listen on open port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eliminated the Listen in sites-enabled/000-default.conf. That fixed the problem.

Thanks for your help.

Dan

On Dec 15, 2022, at 7:10 PM, Frank Gingras <thumbs@xxxxxxxxxx> wrote:

Dan,

The error pertains to port 4443, not 443. You have to remove the duplicate Listen directive for port 4443, and not 443.

On Thu, Dec 15, 2022 at 8:58 PM Dan Nessett <dnessett@xxxxxxxxx.invalid> wrote:
In case you are unfamiliar with the block comment approach using <IfDefine IgnoreBlockComment>, I used the traditional # comment indication and got the same result:

dnessett@Mount:/etc/apache2$ cat ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

#Listen 80

<IfModule ssl_module>
Listen 4443
</IfModule>

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

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
dnessett@Mount:/etc/apache2$ sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
dnessett@Mount:/etc/apache2$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled-runtime; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Thu 2022-12-15 18:52:14 MST; 1min 7s ago
  Process: 1823 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Dec 15 18:52:14 Mount systemd[1]: Starting The Apache HTTP Server...
Dec 15 18:52:14 Mount apachectl[1823]: (98)Address already in use: AH00072: make_sock: could not bind to address 127.0.0.1:4443
Dec 15 18:52:14 Mount apachectl[1823]: no listening sockets available, shutting down
Dec 15 18:52:14 Mount apachectl[1823]: AH00015: Unable to open logs
Dec 15 18:52:14 Mount apachectl[1823]: Action 'start' failed.
Dec 15 18:52:14 Mount apachectl[1823]: The Apache error log may have more information.
Dec 15 18:52:14 Mount systemd[1]: apache2.service: Control process exited, code=exited status=1
Dec 15 18:52:14 Mount systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 15 18:52:14 Mount systemd[1]: Failed to start The Apache HTTP Server.
dnessett@Mount:/etc/apache2$

On Dec 15, 2022, at 6:40 PM, Frank Gingras <thumbs@xxxxxxxxxx> wrote:

So you clearly had two listen directives for the same port; remove one.

On Thu, Dec 15, 2022 at 8:30 PM Dan Nessett <dnessett@xxxxxxxxx.invalid> wrote:
Thanks. My understanding is "systemctl restart apache2” waits the appropriate amount of time between the stop and start.

Dan

On Dec 15, 2022, at 5:44 PM, John Iliffe <john.iliffe@xxxxxxxxx> wrote:

Try 

systenctl httpd stop, 

then when ps -ef | grep httpd shows that httpd is gone

systemctl httpd start

to give the system time to release all the resources.

John
======
On Thu, 2022-12-15 at 17:28 -0700, Dan Nessett wrote:
Thanks for the info. However, I don’t believe any of the problems suggested in
the wiki apply.

1. The output from both lsof and netstat -plant indicate no other process is
using port 4443 either before or after apache2 is started

2. There does not seem to be conflicting Listen commands in the apache sites-
available files.

3. The Listen in 000-default.conf is: Listen localhost:4443 ssl; and the
Virtual Host entry is: <VirtualHost localhost:4443> ServerName
coop.mountolive.com:4443 … localhost and coop.mountolive.com are both valid
values as is port 4443.

4. I believe systemctl status apache2.service starts apache2 as root

5. SELinux is not active, i.e.,

semanage port -l|grep http
Command 'semanage' not found, but can be installed with:
sudo apt install policycoreutils-python-utils

I have attached output from the terminal commands that tests these hypotheses
to this message, as it is fairly long and including it in the body of the
message might make it hard to analyze.

By the way, the apache2 version is: Server version: Apache/2.4.29 (Ubuntu)
Server built:   2022-06-23T12:51:37

On Dec 15, 2022, at 4:12 PM, Frank Gingras <thumbs@xxxxxxxxxx> wrote:

Consider our wiki article for this:

https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux