March 18, 2007 at 5:34 pm
· Filed under Random
I’ve migrated our image server from apache to lighttpd, it certainly feels a bit faster, but preventing hotlinking is not as easy as with apache.
The standard documentation only tells you how to deny access to images when hotlinked, but I want people to know that they’re hotlinking images. So I needed any hotlinked image to be responded with a “don’t hotlink”-image.
It was a bit of struggle trying to find the right syntax, but I finally succeeded. This is doing it’s work great
$HTTP["referer"] !~ “^($|http://(.*)?kmfstudio|afspot\.com)” {
$HTTP["referer"] !~ “^($|http://(.*)?asianfanatics|afspot|hkadb|afmag\.net)” {
url.redirect = (
“(/.*\.(JPG|jpe?g|png|gif))$” => “http://kmfstudio.com/hotlinking/hotlinking.jpg”
)
}
}
Permalink
March 9, 2007 at 10:53 pm
· Filed under Technical issues
Because our fileserver is getting inefficient for the insane traffic that our network is generating, i’ve rented a new server to test out lighttpd. However I found out that each time logrotate is run, the lighttpd-process will be frozen.
I’m now changing the logrotate-script. Instead of the usual “reload”, i’ve changed it force-reload. If that doesn’t work either, i’ll have to do a restart…
This is how /etc/logrotate.d/lighttpd looks like now
/var/log/lighttpd/*.log {
daily
missingok
copytruncate
size=100M
delaycompress
rotate 7
compress
notifempty
sharedscripts
postrotate
if [ -f /var/run/lighttpd.pid ]; then \
if [ -x /usr/sbin/invoke-rc.d ]; then \
invoke-rc.d lighttpd force-reload > /dev/null; \
else \
/etc/init.d/lighttpd force-reload > /dev/null; \
fi; \
fi;
endscript
}
Permalink