Here are some stats I've developed for varnish to be monitored via cacti:
http://forums.cacti.net/post-156230.html
Friday, February 20, 2009
Tuesday, February 10, 2009
Drupal Boost rules for nginx
Drupal has a nice module to boost its performance called Boost. It provides static page caching for anonymous users, i.e. it creates a static page for each url once it was requested. Static caching fully relies on rewrite rules, and Boost developers provide sample mod_rewrite rules to use with apache web server.
Unfortunately I couldn't find any working rules for nginx, so I have to develop them by myself. The main problem with nginx is that you can't specify multiple conditions. However there is a workaround (an ugly one, but it works).
Following lines should be inserted under "location /". Remember that order is important here, last rule is default drupal rule for nginx.
## Boost rewrite rules
set $boost "";
if ( $request_method = GET ) {
set $boost G;
}
if ($http_cookie !~ "DRUPAL_UID") {
set $boost "${boost}D";
}
if ($query_string = "") {
set $boost "${boost}Q";
}
if ( -f $document_root/cache/$host/0/index.html ) {
set $boost "${boost}I";
}
## GDQI, request is for main page
if ($boost = GDQI) {
rewrite ^/$ /cache/$server_name/0/index.html break;
}
if ( -f $document_root/cache/$host/0$request_uri.html ) {
set $boost "${boost}F";
}
## GDQIF, the request is for subpage
if ($boost = GDQIF) {
rewrite .? /cache/$server_name/0$request_uri.html break;
}
if ( -d $document_root/cache/$host/0$request_uri ) {
set $boost "${boost}E";
}
if ( -f $document_root/cache/$host/0$request_uri/index.html ) {
set $boost "${boost}F";
}
## GDQEF, the request is for module main page
if ($boost = GDQEF) {
rewrite .? /cache/$server_name/0$request_uri/index.html break;
}
## Boost rewrite rules end
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
Unfortunately I couldn't find any working rules for nginx, so I have to develop them by myself. The main problem with nginx is that you can't specify multiple conditions. However there is a workaround (an ugly one, but it works).
Following lines should be inserted under "location /". Remember that order is important here, last rule is default drupal rule for nginx.
## Boost rewrite rules
set $boost "";
if ( $request_method = GET ) {
set $boost G;
}
if ($http_cookie !~ "DRUPAL_UID") {
set $boost "${boost}D";
}
if ($query_string = "") {
set $boost "${boost}Q";
}
if ( -f $document_root/cache/$host/0/index.html ) {
set $boost "${boost}I";
}
## GDQI, request is for main page
if ($boost = GDQI) {
rewrite ^/$ /cache/$server_name/0/index.html break;
}
if ( -f $document_root/cache/$host/0$request_uri.html ) {
set $boost "${boost}F";
}
## GDQIF, the request is for subpage
if ($boost = GDQIF) {
rewrite .? /cache/$server_name/0$request_uri.html break;
}
if ( -d $document_root/cache/$host/0$request_uri ) {
set $boost "${boost}E";
}
if ( -f $document_root/cache/$host/0$request_uri/index.html ) {
set $boost "${boost}F";
}
## GDQEF, the request is for module main page
if ($boost = GDQEF) {
rewrite .? /cache/$server_name/0$request_uri/index.html break;
}
## Boost rewrite rules end
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
Wednesday, December 24, 2008
LDAP group based access for Drupal
Sometimes you need to limit access to a Drupal instance to a single group in LDAP. Drupal has LDAP authentication module which works great. However, there is no way of setting group based access via its web interface.
The solution is to adjust ldapauth_user_filter function in sites/all/modules/ldap_integration/ldap_integration/ldapauth.conf.php. In order to allow users from "drupal_access" group only, change it to something similar to this:
function ldapauth_user_filter(&$attributes) {
if ($attributes['memberof'][0] == "CN=drupal_access,CN=Users,DC=domain,DC=local")
return TRUE;
else
return FALSE;
}
The solution is to adjust ldapauth_user_filter function in sites/all/modules/ldap_integration/ldap_integration/ldapauth.conf.php. In order to allow users from "drupal_access" group only, change it to something similar to this:
function ldapauth_user_filter(&$attributes) {
if ($attributes['memberof'][0] == "CN=drupal_access,CN=Users,DC=domain,DC=local")
return TRUE;
else
return FALSE;
}
Subscribe to:
Posts (Atom)