## Apache Update Today

I take the unusual measure of hosting this site, and this blog, on my home computer, which I name ‘Phoenix’. This requires that I forward all requests to my URL, to My Home IP Address. Hence, if you’re on a Linux computer and want my current IP address, you’d just type in:


host dirkmittler.homeip.net



But of course, in order to host a Web-site, I also need to be running a fully-configured Web-server. Under Linux, this pretty much implies running Apache.

The version of Apache on this box was just updated this evening, to version ‘2.4.10-10+deb8u10‘. When the server is updated like this, a post-install command is also given to restart it, since otherwise the new software will not have been loaded into RAM, nor running. But this should not cause much of a disruption, because essentially it just causes a connection to disappear for about 2 seconds.

The reason for that would be, the fact that each HTTP Request is handled separately, and after each HTTP Request has fetched a page, or an update to a page, the CGI-Script that did so exits. This means that if the reader is noticing a ‘stateful session’, which has persistent data from one page-reload to the next, this actually requires that a database act as a back-end to the site, and that the Web-server’s CGI-Scripts can act as a client to that database. And cookies on the browser, in certain cases, identify a session. For readers of this blog who are not logged-in, such cookies are not being used.

In my case, it’s a MySQL server.

One thing that might however happen to a reader, due to such a server-restart, is that an established session gets interrupted momentarily. This would have happened around 19h45 this evening.

The reason that can happen, is the use of Web-sockets on this site. Essentially, only the browser’s initial request to connect, is actually made to Port 80 of the server. After that, the session of one particular browser (client) is handed off to a Web-socket, which is actually some obscure port on my computer, owned by an Apache sub-process.

If the sub-process is killed, any browsers that were still connected to it would have experienced a disconnection. Because browsers tend to ‘remember’ which Web-socket they were connected to when simply prompted to reload a page, this disconnection might last until the reader restarts his browser.

## Routine Apache Server Update Today

One fact which I mention often, is that I use my home computer, which I name ‘Phoenix’, as a Web-server, and as the hosting server for this blog.

For any readers who have questions on how this is possible, I’d direct you Here.

Updates which are somewhat remarkable, such as an actual update to the Web-server, but which seemed to take place without any technical problems, I document in this blog as ‘routine updates’.

The update to my Apache Web-server, that brought it up to version ‘2.4.10-10+deb8u9‘, just took place today. Doing so actually does require a restart of the server. But that kind of restart simply takes place within a few seconds, and without any detriment to the availability of the site, because of the way Web-servers generally work.

Dirk

## There is a minor bug in the latest Apache server.

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>
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.

## Routine Update to my Apache Server Today

As I have written many times, I host my Web-site and blog on my own server, from home. The actual Web-server is a complex piece of software called ‘‘.

Today, a set of updates was pushed through the Debian repositories, specifically to this server. This update meant that I was briefly offline from about 20h15 until 20h17.

My site is up again, and this time around, there was never any need for me to restart my caching daemon, for which reason the response of my server to the routine queries by readers should not be slowed down.

Enjoy.

Dirk