In recent weeks, a package update to the ‘apache2
‘ server, brought its Debian version up to ‘2.4.10-10+deb8u8
‘ . I am sure that this update brought some good new features to the server, which I will not even have the personal skill to appreciate fully. But unfortunately it also brought a bug.
Usually, this command-line:
/etc/init.d/apache2 restart
Is supposed to perform a complete restart of the server. But as of the latest update, that command-line only shuts down the server, killing all its processes. However, next giving this command-line:
/etc/init.d/apache2 start
Simply causes the sever to start up again, as if nothing had gone wrong.
This bug could be hard to spot, because Apache
is atypical in its behavior regarding updates. Often, updates to packages ‘apache2
‘ depends on, only force a partial reload of the server, not a complete restart. Such a reload takes place successfully on my machine, every morning.
However, the update itself caused Apache
not to restart correctly, thus requiring a manual restart, whenever that took place.
Dirk
(Edit 05/04/2017 : )
I think I may have discovered the configuration error, quite by accident, which may have contributed to this bug. The way Apache is set up under Debian, it has two places that effectively specify the same information:
/etc/apache2/ports.conf
/etc/apache2/sites-available/default-ssl.conf
The problem, as I see it, was that I had set up the first file like so:
# 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 0.0.0.0:80
<IfModule ssl_module>
Listen 0.0.0.0:10443
</IfModule>
<IfModule mod_gnutls.c>
Listen 0.0.0.0:10443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
while setting up the second file like so:
<IfModule mod_ssl.c>
<VirtualHost *:10443>
ServerAdmin admin@dirkmittler.homeip.net
DocumentRoot /var/www/html
What this means is, that with Apache configuration files, to use the wildcard ‘0.0.0.0:
‘, constrains the server only to listen on IPv4 interfaces, while in the second file, to use the wildcard ‘*:
‘, correctly tells the server to listen both on IPv4 and on IPv6 interfaces. So there existed a mismatch, and the correct way to configure
/etc/apache2/ports.conf
is like so:
# 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 10443
</IfModule>
<IfModule mod_gnutls.c>
Listen 10443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Dirk
(Edit 05/08/2017 : )
I have now pinpointed the problem exactly. When Apache receives a “Graceful Restart Request”, it ignores the configuration above completely, and tries to bind to ports 443. These ports are already belonging to another process, and so Apache shuts down.
But, when I start the Apache server manually, it takes the configuration files into account normally, and starts listening on IPv4 and IPv6 ports 10443.