domenica 14 dicembre 2008

NSLU2 && lighttpd && esmtp

This morning I came up with an idea. How could I know when someone access to my lighttpd webserver installed on my NSLU2?

The answer is easy, denever, active mod_accesslog and then take a look to the access.log!

Ok, but if I want to reaceive a mail for each access? :)

Reading there, I discovered that it is possible to redirect the access.log to a process.

So I wrote this line in the /etc/lighttpd/lighttpd.conf on my NSLU2:

accesslog.filename = "| mail -i -s Webaccess my_email@anywhere.com"


The I installed and configured esmtp on my NSLU2:

apt-get install esmtp

Editing /etc/esmtprc:

hostname=smtp.googlemail.com
username=yourname@gmail.com
password=yourpass
starttls=enabled

But there is a problem: lighttpd write access.log only when is stopped...
So I shall not receive an email on each access on my webserver.
I will receive an email on each restart of lighttpd.

Nessun commento:

Posta un commento