disable logging of images in access log
Wed, 12/15/2010 - 17:15 — sandipApache:
SetEnvIfNoCase Request_URI "\.(gif|jpe?g|png|htc|css |js|ico)$" skiplog
CustomLog "/var/log/httpd/access.lo g" combined env=!skiplog
Lighttpd:
$HTTP["url"] =~ "\.(gif|jpe?g|png|htc|css |js|ico)$" {
accesslog.filename = "/dev/null"
}
lighttpd redirect to external url if file not found
Mon, 06/28/2010 - 14:57 — sandipBelow is a rewrite/redirect rule using url.rewrite-[repeat]-if-not-fi
# Redirect to external url if image file not found
url.rewrite-if-not-file = ( "^\/images\/.*\.jpg$" ; => "/redirect$0" )
url.redirect = ( "^\/redirect\/(.*)$" => "http://other.domain.tld/ $1" )
- sandip's blog
- Login or register to post comments
Deny access to .htaccess files in lighttpd
Sun, 06/27/2010 - 21:36 — sandipIn lighttpd you can use mod_access to deny files starting with a certain expression, such as hidden dot files. (example: .htaccess or .svn)
# Deny access to hidden files
$HTTP["url"] =~ "/\." {
url.access-deny = ("")
}
- sandip's blog
- Login or register to post comments
Munin stats for apache and lighttpd
Wed, 09/02/2009 - 16:49 — sandipGet status of apache (80) and lighttpd (81) on different ports:
This is done at the nodes.
-
Enable apache server-status in httpd.conf :
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
$HTTP["remoteip"] == "127.0.0.1" {
status.status-url   ;   ; = "/server-status"
}
[apache*]
env ports="80 81"
* Test with:
ports="80 83" /etc/munin/plugins/apache_proc esses
lighttpd idle process will be a straight line as total of busy and idle process is always the same when drawn as STACK, . To change this to LINE1:
At the host, edit "/etc/munin/munin.conf" and add the below line to the corresponding host:
apache_processes.idle81.draw LINE1
- sandip's blog
- Login or register to post comments
- Read more
Lighttpd client side optimization
Wed, 09/02/2009 - 12:06 — sandip-
Edit conf file: /etc/lighttpd/lighttpd.conf
Enable mod_expire and mod_compress.
Expire static files set for 3 days:
$HTTP["url"] =~ "\.(js|css|gif|jpg|png|ic o|txt|swf|html|htm)$" { expire.url = ( "" => "access 3 days" ) }
compress.cache-dir = "/var/cache/lighttpd/comp ress/"
compress.filetype   ;   ; = ("text/plain", "text/html", "text/css", "text/xml", "text/javascript")
#!/bin/bash
# lighttpd_cache_clean
# Clean cache stored at /var/cache/lighttpd/compressr /># Place in /etc/cron.daily
# Cache dir path
CROOT="/var/cache/light tpd/compress"
#Deleting files older than 3 days
HOURS=72
# Lighttpd user and group
LUSER="lighttpd"r />LGROUP="lighttpd"< br />
# start cleaning
/usr/sbin/tmpwatch --mtime ${HOURS} ${CROOT}
# if directory missing just recreate it
if [ ! -d $CROOT ]
then
&nbs p; mkdir -p $CROOT
&nbs p; chown ${LUSER}:${LGROUP} ${CROOT}
fi
exit 0
mkdir -p /var/cache/lighttpd/compressr />chown lighttpd:lighttpd /var/cache/lighttpd/compress