Apache Tricks
Set Server Agent Name
sudo apt-get install libapache2-mod-security2
Once the module is installed, you can modify the Apache config under the file /etc/apache2/apache2.conf
. Add this line around the end of the file.
<IfModule mod_security2.c>
SecServerSignature "ecoware"
</IfModule>
How to set the Expires Headers in Apache
enable expires and headers modules for Apache
sudo a2enmod expires;
sudo a2enmod headers;
Edit the /etc/apache2/apache2.conf file
sudo nano /etc/apache2/apache2.conf
Add the following
<IfModule mod_expires.c>
ExpiresActive on
AddType image/x-icon .ico
ExpiresDefault "access plus 2 hours"
ExpiresByType text/html "access plus 7 days"
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpg "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType image/png "access plus 7 days"
ExpiresByType text/js "access plus 2 hours"
ExpiresByType text/javascript "access plus 2 hours"
ExpiresByType text/plain "access plus 2 hours"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType image/ico "access plus 30 days"
</IfModule>
Restart apache
sudo service apache2 restart
Check that it worked by loading an image. You should see an expired line in the output such as
Expires: Wed, 22 Aug 2020 22:03:35 GMT