Mailing List Archive

Apache2 fails to listen on open port
I am attempting to set up apache with sslh. The latter is running fine, but when I attempt to start the apache2 server, it fails with the following message:

dnessett@Mount:/etc/apache2/sites-available$ 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.

Wnen I investigate further (asking for apache status), I find the following:

dnessett@Mount:/etc/apache2/sites-available$ systemctl status apache2.service
? 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 11:08:46 MST; 41s ago
Process: 2520 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

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

Since it appears port 4443 is already in use, I print the active listen addresses:

dnessett@Mount:/etc/apache2/sites-available$ sudo lsof -i -P -n | grep LISTEN
systemd-r 760 systemd-resolve 13u IPv4 20577 0t0 TCP 127.0.0.53:53 (LISTEN)
cupsd 859 root 6u IPv6 21248 0t0 TCP [::1]:631 (LISTEN)
cupsd 859 root 7u IPv4 21249 0t0 TCP 127.0.0.1:631 (LISTEN)
vsftpd 977 root 3u IPv6 21478 0t0 TCP *:21 (LISTEN)
sshd 989 root 3u IPv4 23513 0t0 TCP *:22 (LISTEN)
sshd 989 root 4u IPv6 23515 0t0 TCP *:22 (LISTEN)
mysqld 1565 mysql 17u IPv6 26365 0t0 TCP *:3306 (LISTEN)
sslh 2166 sslh 3u IPv4 75977 0t0 TCP 98.127.182.220:443 (LISTEN)
sslh 2167 sslh 3u IPv4 75977 0t0 TCP 98.127.182.220:443 (LISTEN)

As is shown, there is no active listen address for port 4443. journalctl -xe gave no additional information.

I have configured apache to listen on 4443, since sslh listens on 443 and forwards https requests to port 4443. I am using a virtual host for this purpose in 000-default.conf, which I include below (notice I have commented out the listen on port 80, since I only want apache to listen for https requests). I have also commented out some <Directory > directives that came from an XAMPP configuration, which I have disabled. If I get apache working I will remove most of this commented out text

dnessett@Mount:/etc/apache2/sites-available$ cat 000-default.conf
# Comment out the port 80 virtual host block

<IfDefine IgnoreBlockComment>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
</IfDefine>

Listen localhost:4443 ssl;

# These defintions are in the main conf file

<IfDefine IgnoreBlockComment>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</IfDefine>

# Comment out the lampp phpadmin and htdocs Directory blocks

<IfDefine IgnoreBlockComment>
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</IfDefine>

<VirtualHost localhost:4443>
ServerName coop.mountolive.com:4443
DocumentRoot /var/www/sites/coop-mountolive

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile /root/.acme.sh/*.mountolive.com/fullchain.cer
SSLCertificateKeyFile /root/.acme.sh/*.mountolive.com/*.mountolive.com.key
</VirtualHost>

For completeness, I include below the configuration information for sslh:

dnessett@Mount:/etc/default$ cat sslh
# Default options for sslh initscript
# sourced by /etc/init.d/sslh

# Disabled by default, to force yourself
# to read the configuration:
# - /usr/share/doc/sslh/README.Debian (quick start)
# - /usr/share/doc/sslh/README, at "Configuration" section
# - sslh(8) via "man sslh" for more configuration details.
# Once configuration ready, you *must* set RUN to yes here
# and try to start sslh (standalone mode only)

RUN=yes

# binary to use: forked (sslh) or single-thread (sslh-select) version
# systemd users: don't forget to modify /lib/systemd/system/sslh.service
DAEMON=/usr/sbin/sslh

DAEMON_OPTS="--user sslh --listen coop.mountolive.com:443 --ssh 127.0.0.1:22 --ssl localhost:4443 --pidfile /var/run/sslh/sslh.pid"

Thanks for any help you can give.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache2 fails to listen on open port [ In reply to ]
Consider our wiki article for this:

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

On Thu, Dec 15, 2022 at 5:16 PM Dan Nessett <dnessett@yahoo.com.invalid>
wrote:

> I am attempting to set up apache with sslh. The latter is running fine,
> but when I attempt to start the apache2 server, it fails with the following
> message:
>
> dnessett@Mount:/etc/apache2/sites-available$ 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.
>
> Wnen I investigate further (asking for apache status), I find the
> following:
>
> dnessett@Mount:/etc/apache2/sites-available$ systemctl status
> apache2.service
> ? 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 11:08:46 MST;
> 41s ago
> Process: 2520 ExecStart=/usr/sbin/apachectl start (code=exited,
> status=1/FAILURE)
>
> Dec 15 11:08:46 Mount systemd[1]: Starting The Apache HTTP Server...
> Dec 15 11:08:46 Mount apachectl[2520]: (98)Address already in use:
> AH00072: make_sock: could not bind to address 127.0.0.1:4443
> Dec 15 11:08:46 Mount apachectl[2520]: no listening sockets available,
> shutting down
> Dec 15 11:08:46 Mount apachectl[2520]: AH00015: Unable to open logs
> Dec 15 11:08:46 Mount apachectl[2520]: Action 'start' failed.
> Dec 15 11:08:46 Mount apachectl[2520]: The Apache error log may have more
> information.
> Dec 15 11:08:46 Mount systemd[1]: apache2.service: Control process exited,
> code=exited status=1
> Dec 15 11:08:46 Mount systemd[1]: apache2.service: Failed with result
> 'exit-code'.
> Dec 15 11:08:46 Mount systemd[1]: Failed to start The Apache HTTP Server.
>
> Since it appears port 4443 is already in use, I print the active listen
> addresses:
>
> dnessett@Mount:/etc/apache2/sites-available$ sudo lsof -i -P -n | grep
> LISTEN
> systemd-r 760 systemd-resolve 13u IPv4 20577 0t0 TCP
> 127.0.0.53:53 (LISTEN)
> cupsd 859 root 6u IPv6 21248 0t0 TCP [::1]:631
> (LISTEN)
> cupsd 859 root 7u IPv4 21249 0t0 TCP
> 127.0.0.1:631 (LISTEN)
> vsftpd 977 root 3u IPv6 21478 0t0 TCP *:21
> (LISTEN)
> sshd 989 root 3u IPv4 23513 0t0 TCP *:22
> (LISTEN)
> sshd 989 root 4u IPv6 23515 0t0 TCP *:22
> (LISTEN)
> mysqld 1565 mysql 17u IPv6 26365 0t0 TCP *:3306
> (LISTEN)
> sslh 2166 sslh 3u IPv4 75977 0t0 TCP
> 98.127.182.220:443 (LISTEN)
> sslh 2167 sslh 3u IPv4 75977 0t0 TCP
> 98.127.182.220:443 (LISTEN)
>
> As is shown, there is no active listen address for port 4443. journalctl
> -xe gave no additional information.
>
> I have configured apache to listen on 4443, since sslh listens on 443 and
> forwards https requests to port 4443. I am using a virtual host for this
> purpose in 000-default.conf, which I include below (notice I have commented
> out the listen on port 80, since I only want apache to listen for https
> requests). I have also commented out some <Directory > directives that came
> from an XAMPP configuration, which I have disabled. If I get apache working
> I will remove most of this commented out text
>
> dnessett@Mount:/etc/apache2/sites-available$ cat 000-default.conf
> # Comment out the port 80 virtual host block
>
> <IfDefine IgnoreBlockComment>
> <VirtualHost *:80>
> # The ServerName directive sets the request scheme, hostname and
> port that
> # the server uses to identify itself. This is used when creating
> # redirection URLs. In the context of virtual hosts, the ServerName
> # specifies what hostname must appear in the request's Host:
> header to
> # match this virtual host. For the default virtual host (this
> file) this
> # value is not decisive as it is used as a last resort host
> regardless.
> # However, you must set it for any further virtual host explicitly.
> #ServerName www.example.com
>
> ServerAdmin webmaster@localhost
> DocumentRoot /var/www/html
>
> # Available loglevels: trace8, ..., trace1, debug, info, notice,
> warn,
> # error, crit, alert, emerg.
> # It is also possible to configure the loglevel for particular
> # modules, e.g.
> #LogLevel info ssl:warn
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> # For most configuration files from conf-available/, which are
> # enabled or disabled at a global level, it is possible to
> # include a line for only one particular virtual host. For example
> the
> # following line enables the CGI configuration for this host only
> # after it has been globally disabled with "a2disconf".
> #Include conf-available/serve-cgi-bin.conf
> </VirtualHost>
> </IfDefine>
>
> Listen localhost:4443 ssl;
>
> # These defintions are in the main conf file
>
> <IfDefine IgnoreBlockComment>
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> Require all denied
> </Directory>
>
> <Directory /usr/share>
> AllowOverride None
> Require all granted
> </Directory>
>
> <Directory /var/www/>
> Options Indexes FollowSymLinks
> AllowOverride None
> Require all granted
> </Directory>
> </IfDefine>
>
> # Comment out the lampp phpadmin and htdocs Directory blocks
>
> <IfDefine IgnoreBlockComment>
> <Directory "/opt/lampp/phpmyadmin">
> AllowOverride AuthConfig Limit
> Require all granted
> ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
> </Directory>
>
> <Directory "/opt/lampp/apache2/htdocs">
> Options Indexes FollowSymLinks
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </IfDefine>
>
> <VirtualHost localhost:4443>
> ServerName coop.mountolive.com:4443
> DocumentRoot /var/www/sites/coop-mountolive
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> SSLEngine on
> SSLCertificateFile /root/.acme.sh/*.mountolive.com/fullchain.cer
> SSLCertificateKeyFile /root/.
> acme.sh/*.mountolive.com/*.mountolive.com.key
> </VirtualHost>
>
> For completeness, I include below the configuration information for sslh:
>
> dnessett@Mount:/etc/default$ cat sslh
> # Default options for sslh initscript
> # sourced by /etc/init.d/sslh
>
> # Disabled by default, to force yourself
> # to read the configuration:
> # - /usr/share/doc/sslh/README.Debian (quick start)
> # - /usr/share/doc/sslh/README, at "Configuration" section
> # - sslh(8) via "man sslh" for more configuration details.
> # Once configuration ready, you *must* set RUN to yes here
> # and try to start sslh (standalone mode only)
>
> RUN=yes
>
> # binary to use: forked (sslh) or single-thread (sslh-select) version
> # systemd users: don't forget to modify /lib/systemd/system/sslh.service
> DAEMON=/usr/sbin/sslh
>
> DAEMON_OPTS="--user sslh --listen coop.mountolive.com:443 --ssh
> 127.0.0.1:22 --ssl localhost:4443 --pidfile /var/run/sslh/sslh.pid"
>
> Thanks for any help you can give.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Apache2 fails to listen on open port [ In reply to ]
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 <http://coop.mountolive.com:4443/> … localhost and coop.mountolive.com <http://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@apache.org> wrote:
>
> Consider our wiki article for this:
>
> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress <https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>
Re: Apache2 fails to listen on open port [ In reply to ]
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@apache.org> wrote:
> >
> > Consider our wiki article for this:
> >
> > https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
> >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache2 fails to listen on open port [ In reply to ]
What does the apache error log say (not systemd)?

Also, am I seeing right? you specified "Listen localhost:4443 ssl;"
with a semicolon at the end?

Also specify it with ips , don't use names with Listen directive.

El vie, 16 dic 2022 a las 1:45, John Iliffe (<john.iliffe@iliffe.ca>) escribió:
>
> 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@apache.org> wrote:
> > >
> > > Consider our wiki article for this:
> > >
> > > https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
> > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > > For additional commands, e-mail: users-help@httpd.apache.org
> > > >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


--
Daniel Ferradal
HTTPD Project
#httpd help at Libera.Chat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache2 fails to listen on open port [ In reply to ]
Grep every single config file (recursively) for the Listen directive.

On Thu, Dec 15, 2022 at 7:54 PM Daniel Ferradal <dferradal@apache.org>
wrote:

> What does the apache error log say (not systemd)?
>
> Also, am I seeing right? you specified "Listen localhost:4443 ssl;"
> with a semicolon at the end?
>
> Also specify it with ips , don't use names with Listen directive.
>
> El vie, 16 dic 2022 a las 1:45, John Iliffe (<john.iliffe@iliffe.ca>)
> escribió:
> >
> > 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@apache.org>
> wrote:
> > > >
> > > > Consider our wiki article for this:
> > > >
> > > >
> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
> > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > > > For additional commands, e-mail: users-help@httpd.apache.org
> > > > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
>
> --
> Daniel Ferradal
> HTTPD Project
> #httpd help at Libera.Chat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Apache2 fails to listen on open port [ In reply to ]
Thanks for the suggestions. Here are the results:

dnessett@Mount:/etc/apache2$ grep -r Listen
sites-available/000-default.conf:Listen localhost:4443 ssl;
ports.conf:#Listen 80
ports.conf: Listen 4443
ports.conf: Listen 443
dnessett@Mount:/etc/apache2$

The ports.conf entry with Listen 443 is for mod_gnutls. Might this be the problem? I am not familiar with mod_gnutls, but it does not appear in any other active configuration file:

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>

dnessett@Mount:/etc/apache2$ grep -r gnutls
ports.conf:<IfModule mod_gnutls.c>
dnessett@Mount:/etc/apache2$

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

The apache error log does not give much information on this problem:

dnessett@Mount:/var/log/apache2$ cat error.log.1
[Wed Dec 14 14:32:34.057530 2022] [mpm_event:notice] [pid 1085:tid 3082604736] AH00489: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Wed Dec 14 14:32:34.057692 2022] [core:notice] [pid 1085:tid 3082604736] AH00094: Command line: '/usr/sbin/apache2'
[Wed Dec 14 17:31:53.108447 2022] [mpm_event:notice] [pid 1085:tid 3082604736] AH00491: caught SIGTERM, shutting down
[Wed Dec 14 22:16:33.935138 2022] [mpm_event:notice] [pid 1059:tid 3082719424] AH00489: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Wed Dec 14 22:16:34.030023 2022] [core:notice] [pid 1059:tid 3082719424] AH00094: Command line: '/usr/sbin/apache2'
[Wed Dec 14 22:18:39.347403 2022] [mpm_event:notice] [pid 1059:tid 3082719424] AH00491: caught SIGTERM, shutting down
dnessett@Mount:/var/log/apache2$

There is a semicolon after the Listen localhost:4443. I was following the instructions given in the sslh installation guide: https://ostechnix.com/sslh-share-port-https-ssh/ <https://ostechnix.com/sslh-share-port-https-ssh/>

I have changed the references to localhost in the one Listen to 127.0.0.1, as you suggest.


> On Dec 15, 2022, at 5:56 PM, Frank Gingras <thumbs@apache.org> wrote:
>
> Grep every single config file (recursively) for the Listen directive.
>
> On Thu, Dec 15, 2022 at 7:54 PM Daniel Ferradal <dferradal@apache.org <mailto:dferradal@apache.org>> wrote:
> What does the apache error log say (not systemd)?
>
> Also, am I seeing right? you specified "Listen localhost:4443 ssl;"
> with a semicolon at the end?
>
> Also specify it with ips , don't use names with Listen directive.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>
Re: Apache2 fails to listen on open port [ In reply to ]
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@iliffe.ca> 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@apache.org> wrote:
>>>
>>> Consider our wiki article for this:
>>>
>>> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
Re: Apache2 fails to listen on open port [ In reply to ]
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@yahoo.com.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@iliffe.ca> 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@apache.org> wrote:
>
> Consider our wiki article for this:
>
> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
Re: Apache2 fails to listen on open port [ In reply to ]
Following up on the mod_gnutls entry in ports.conf, I commented out the entry and restarted apache. It didn’t fix the problem.

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>

<IfDefine IgnoreBlockComment>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
</IfDefine>

# 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:38:56 MST; 5min ago
Process: 1771 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

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

> On Dec 15, 2022, at 5:56 PM, Frank Gingras <thumbs@apache.org> wrote:
>
> Grep every single config file (recursively) for the Listen directive.
>
> On Thu, Dec 15, 2022 at 7:54 PM Daniel Ferradal <dferradal@apache.org <mailto:dferradal@apache.org>> wrote:
> What does the apache error log say (not systemd)?
>
> Also, am I seeing right? you specified "Listen localhost:4443 ssl;"
> with a semicolon at the end?
>
> Also specify it with ips , don't use names with Listen directive.
>
> El vie, 16 dic 2022 a las 1:45, John Iliffe (<john.iliffe@iliffe.ca <mailto:john.iliffe@iliffe.ca>>) escribió:
> >
> > 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 <http://coop.mountolive.com:4443/> … localhost and coop.mountolive.com <http://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@apache.org <mailto:thumbs@apache.org>> wrote:
> > > >
> > > > Consider our wiki article for this:
> > > >
> > > > https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress <https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress>
> > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> > > > > For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
> > > > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> > For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
> >
>
>
> --
> Daniel Ferradal
> HTTPD Project
> #httpd help at Libera.Chat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>
Re: Apache2 fails to listen on open port [ In reply to ]
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@apache.org> 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@yahoo.com.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@iliffe.ca <mailto:john.iliffe@iliffe.ca>> 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 <http://coop.mountolive.com:4443/> … localhost and coop.mountolive.com <http://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@apache.org <mailto:thumbs@apache.org>> wrote:
>>>>
>>>> Consider our wiki article for this:
>>>>
>>>> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress <https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress>
>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
>>>>> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
>> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
Re: Apache2 fails to listen on open port [ In reply to ]
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@yahoo.com.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@apache.org> 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@yahoo.com.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@iliffe.ca> 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@apache.org> wrote:
>>
>> Consider our wiki article for this:
>>
>> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>>
>
Re: Apache2 fails to listen on open port [ In reply to ]
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@apache.org> 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@yahoo.com.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 <http://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@apache.org <mailto:thumbs@apache.org>> 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@yahoo.com.invalid <mailto:dnessett@yahoo.com.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@iliffe.ca <mailto:john.iliffe@iliffe.ca>> 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 <http://coop.mountolive.com:4443/> … localhost and coop.mountolive.com <http://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@apache.org <mailto:thumbs@apache.org>> wrote:
>>>>>
>>>>> Consider our wiki article for this:
>>>>>
>>>>> https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress <https://cwiki.apache.org/confluence/display/HTTPD/CouldNotBindToAddress>
>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
>>>>>> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <mailto:users-unsubscribe@httpd.apache.org>
>>> For additional commands, e-mail: users-help@httpd.apache.org <mailto:users-help@httpd.apache.org>
>
RE: Apache2 fails to listen on open port [ In reply to ]
Hi,
Just checking, are you interested acquiring the list of attendees? Please respond my email. I'm waiting for your response.
We are discussing about Prices And, provide the discount cost.
Thank you.


-----Original Message-----
From: Dan Nessett <dnessett@yahoo.com.INVALID>
Sent: Friday, December 16, 2022 3:45 AM
To: users@httpd.apache.org
Subject: [users@httpd] Apache2 fails to listen on open port

I am attempting to set up apache with sslh. The latter is running fine, but when I attempt to start the apache2 server, it fails with the following message:

dnessett@Mount:/etc/apache2/sites-available$ 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.

Wnen I investigate further (asking for apache status), I find the following:

dnessett@Mount:/etc/apache2/sites-available$ systemctl status apache2.service ? 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 11:08:46 MST; 41s ago
Process: 2520 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

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

Since it appears port 4443 is already in use, I print the active listen addresses:

dnessett@Mount:/etc/apache2/sites-available$ sudo lsof -i -P -n | grep LISTEN
systemd-r 760 systemd-resolve 13u IPv4 20577 0t0 TCP 127.0.0.53:53 (LISTEN)
cupsd 859 root 6u IPv6 21248 0t0 TCP [::1]:631 (LISTEN)
cupsd 859 root 7u IPv4 21249 0t0 TCP 127.0.0.1:631 (LISTEN)
vsftpd 977 root 3u IPv6 21478 0t0 TCP *:21 (LISTEN)
sshd 989 root 3u IPv4 23513 0t0 TCP *:22 (LISTEN)
sshd 989 root 4u IPv6 23515 0t0 TCP *:22 (LISTEN)
mysqld 1565 mysql 17u IPv6 26365 0t0 TCP *:3306 (LISTEN)
sslh 2166 sslh 3u IPv4 75977 0t0 TCP 98.127.182.220:443 (LISTEN)
sslh 2167 sslh 3u IPv4 75977 0t0 TCP 98.127.182.220:443 (LISTEN)

As is shown, there is no active listen address for port 4443. journalctl -xe gave no additional information.

I have configured apache to listen on 4443, since sslh listens on 443 and forwards https requests to port 4443. I am using a virtual host for this purpose in 000-default.conf, which I include below (notice I have commented out the listen on port 80, since I only want apache to listen for https requests). I have also commented out some <Directory > directives that came from an XAMPP configuration, which I have disabled. If I get apache working I will remove most of this commented out text

dnessett@Mount:/etc/apache2/sites-available$ cat 000-default.conf # Comment out the port 80 virtual host block

<IfDefine IgnoreBlockComment>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf </VirtualHost> </IfDefine>

Listen localhost:4443 ssl;

# These defintions are in the main conf file

<IfDefine IgnoreBlockComment>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</IfDefine>

# Comment out the lampp phpadmin and htdocs Directory blocks

<IfDefine IgnoreBlockComment>
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var </Directory>

<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</IfDefine>

<VirtualHost localhost:4443>
ServerName coop.mountolive.com:4443
DocumentRoot /var/www/sites/coop-mountolive

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile /root/.acme.sh/*.mountolive.com/fullchain.cer
SSLCertificateKeyFile /root/.acme.sh/*.mountolive.com/*.mountolive.com.key
</VirtualHost>

For completeness, I include below the configuration information for sslh:

dnessett@Mount:/etc/default$ cat sslh
# Default options for sslh initscript
# sourced by /etc/init.d/sslh

# Disabled by default, to force yourself # to read the configuration:
# - /usr/share/doc/sslh/README.Debian (quick start) # - /usr/share/doc/sslh/README, at "Configuration" section # - sslh(8) via "man sslh" for more configuration details.
# Once configuration ready, you *must* set RUN to yes here # and try to start sslh (standalone mode only)

RUN=yes

# binary to use: forked (sslh) or single-thread (sslh-select) version # systemd users: don't forget to modify /lib/systemd/system/sslh.service DAEMON=/usr/sbin/sslh

DAEMON_OPTS="--user sslh --listen coop.mountolive.com:443 --ssh 127.0.0.1:22 --ssl localhost:4443 --pidfile /var/run/sslh/sslh.pid"

Thanks for any help you can give.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org