How to set up Expires header with Apache2 on Ubuntu Lucid 10.04

A very good way to reduce page load time on your website is to tell your visitors’ browser it can cache some specific files and save a copy on the disk.
This process is done by your web-server which is sending an Expires header and a max-age header during the HTTP response, e.g.:

200 OK
Cache-Control: max-age=604800
Connection: close
Date: Tue, 27 Jul 2010 22:31:03 GMT
Accept-Ranges: bytes
ETag: "2c956-376b-4696cb8b385c0"
Server: Apache/2.2.14 (Ubuntu)
Content-Length: 14187
Content-Type: image/gif
Expires: Tue, 03 Aug 2010 22:31:03 GMT
Last-Modified: Fri, 08 May 2009 20:46:23 GMT
Client-Date: Tue, 27 Jul 2010 22:31:02 GMT
Client-Peer: 127.217.30.5:80
Client-Response-Num: 1

Apache2 offers this feature through its mod_expires module. Note that this module is usually disabled by default, meaning your visitors would download all the files over again each time they change the page.

Continue reading “How to set up Expires header with Apache2 on Ubuntu Lucid 10.04”

Easy Apache log statistics using Visitors

There are many Apache log analyzers that you can now choose from, but it can be long or confusing to install most of them. I wanted to try and find a simple log analyzer that just does its work using cronjobs. Visitors seems to fit the needs!
We’ll also use ip2host to resolve the IP addresses into domain names.
All of this will be run daily by a cronjob.

Screenshot of a report generated by Visitors
Screenshot of a report generated by Visitors

Continue reading “Easy Apache log statistics using Visitors”

scanerrlog – Generate summaries/reports from Apache error logs

scanerrlog offers the possibility to generate a summary or report about Apache errors and sort them depending on how frequent they are.

To install it (for Ubuntu users):

sudo apt-get install scanerrlog

or use Synaptic and search for scanerrlog.

It’s written in Python, and it is very easy to use it. (type ‘man scanerrlog‘ in a terminal to see the manual page)

I tested it with Apache2 log files using the following command:

scanerrlog -f text -o /tmp/log.txt /var/log/apache2/*.log
  • -f : format (text, pdf, html, xml)
  • -o : output file
  • args : log files

Continue reading “scanerrlog – Generate summaries/reports from Apache error logs”