Thursday, July 27, 2017

Apache2 Webserver Custom Footer

Due to the continued lack of a stable and fast home Internet connection we have been forced to mirror one of our principal Websites to an American hosting company.

Since there are now 2 domains involved, i.e. we did not move the domain, we wanted a simple way to alert people to the fact that a new mirror site was available to them.   The mirror site is not ideal but is able to serve pages at about 30 Mbits / second, whereas our local webserver can manage a pathetic  0.1 Mbit/second.

Compare this to the previous 500 Mbits/second or faster from our Swiss home and you can see why Marcus is almost in tears.

How to install a custom Apache2 footer

This is the procedure I used on a Linux Mint Server, and Mint is a Ubuntu derivative.

#install security 2 module
apt install libapache2-mod-security2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 115 not upgraded.
Need to get 314 kB of archives.
After this operation, 1'230 kB of additional disk space will be used.
Get:1 xenial/universe amd64 libapache2-mod-security2 amd64 2.9.0-1 [314 kB]
Fetched 314 kB in 0s (414 kB/s)
Selecting previously unselected package libapache2-mod-security2.
(Reading database ... 275014 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-security2_2.9.0-1_amd64.deb ...
Unpacking libapache2-mod-security2 (2.9.0-1) ...
Setting up libapache2-mod-security2 (2.9.0-1) ...

apache2_invoke: Enable module security2

#eenable module
a2enmod security2
Considering dependency unique_id for security2:
Module unique_id already enabled
Module security2 already enabled

# edit the security file and add footer
vi /etc/apache2/conf-enabled/security.conf

# 20170726 Custom Webpage footer
ServerTokens Full
ServerSignature On
SecServerSignature 'NB: Webserver mirror at, regds Marcus Bennett:'

#restart apache2
systemctl restart apache2.service

And here is the finished product

Meanwhile here at the mirror we have an identical layout and content with of course a standard footer since we don't have the power to change this American hosted system.