Troubleshooting Techniques
[ 202 ]
log_format imagelog '[$time_local] $image_file $image_type '
'$body_bytes_sent $status';
log_format authlog '[$time_local] $remote_addr $remote_user '
'"$request" $status';
}
Use multiple access_logs to see which locations are getting called at what times. By
configuring a different access_log for each location, we can easily see which ones are
not being used. Any change to such a location will have no effect on request processing;
the locations higher-up in the processing hierarchy need to be examined first.
http {
log_format sentlog '[$time_local] "$request" $status $body_bytes_
sent ';
log_format imagelog '[$time_local] $image_file $image_type '
'$body_bytes_sent $status';
log_format authlog '[$time_local] $remote_addr $remote_user '
'"$request" $status';
server {
server_name .example.com;
root /home/www;
location / {
access_log logs/example.com-access.log combined;
access_log logs/example.com-root_access.log sentlog;
rewrite ^/(.*)\.(png|jpg|gif)$ /images/$1.$2;
set $image_file $1;
set $image_type $2;