#!/bin/bash www=$2 dirperms="750" fileperms="640" owner="www-data:www-data" function usage { echo "Usage:" echo "$0 --all /home/www" echo "$0 --dir /home/www" echo "$0 --file /home/www" echo "$0 --owner /home/www" } if [[ $1 == "" || $2 == "" ]]; then usage exit 1 fi case $1 in '--all') bash $0 --dir $www bash $0 --file $www bash $0 --owner $www ;; '--dir') echo "fixing dirs in $www ..." find $www -type d -exec sh -c "chmod $dirperms '{}'" \; ;; '--file') echo "fixing files in $www ..." find $www -type f -exec sh -c "chmod $fileperms '{}'" \; ;; '--owner') echo "fixing owner in $www ..." chown -R $owner $www ;; *) usage exit 1 esac exit 0 |
Archives mensuelles : mars 2011
memo varnish *.vcl
vcl_recv Called at the beginning of a request, after the complete
request has been received and parsed. Its purpose is to
decide whether or not to serve the request, how to do it,
and, if applicanle, which backend to use.
vcl_hit Called after a cache lookup if the requested document was
found in the cache.
vcl_miss Called after a cache lookup if the requested document was
not found in the cache. Its purpose is to decide whether or
not to attempt to retrieve the document from the backend,
and which backend to use.
vcl_fetch Called after a document has been retrieved from the backend,
before it is inserted into the cache.
vcl_timeout Called by the reaper thread when a cached document has
reached its expiry time. |
vcl_recv
sub vcl_recv {
if (req.http.host == "be-geek.com" && req.url ~ "\.(gif|jpg|swf|css|js|png|jpg|jpeg|gif|png|tiff|tif|ico)$") {
set req.url = regsub(req.url, "\?.*", "");
set req.http.user-agent = "mozilla";
unset req.http.Cookie;
unset req.http.Authorization;
set req.backend = nginx;
return(lookup);
}
if (req.http.host ~ "^static.bgkcdn.com$" || req.http.host ~ "^static(1|2|3|4).bgkcdn.com$") {
set req.url = regsub(req.url, "\?.*", "");
set req.http.user-agent = "mozilla";
unset req.http.Cookie;
unset req.http.Authorization;
set req.backend = nginx;
return(lookup);
}
if (req.http.host ~ "^download.hio.fr$") {
set req.backend = nginx;
return(pipe);
}
# Properly handle different encoding types
// Remove has_js and Google Analytics __* cookies.
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
// Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
#return(lookup);
} |