<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://frontseed.com">
<channel>
 <title>Front Seed Labs</title>
 <link>http://frontseed.com</link>
 <description />
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/frontseed/lab" /><feedburner:info uri="frontseed/lab" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>frontseed/lab</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
 <title>Nginx configuration for Drupal sites</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/ojezWyv54E0/nginx-configuration-drupal-sites</link>
 <description>&lt;p&gt;I have created a preferred configuration for hosting Drupal sites on the excellent nginx web server. I tend to prefer nginx over Lighttpd and/or Apache for at least over a year now and I'm extremely happy with its reliability and performance.&lt;/p&gt;

&lt;p&gt;Apart from configuring a little more and getting used to the fact that no run-time configurations are available through .htaccess files, nginx with php-fpm is really a viable option for hosting Drupal sites.&lt;/p&gt;

&lt;p&gt;'Nuff said, you can head over to &lt;a href="https://github.com/attila/nginx_drupal"&gt;&lt;strong&gt;GitHub&lt;/strong&gt;&lt;/a&gt; to check out my configuration. The files have many smart ideas taken from &lt;a href="https://github.com/yhager"&gt;&lt;em&gt;yhager&lt;/em&gt;&lt;/a&gt;'s nginx config, however I added more features and tailored the configuration for my needs.&lt;/p&gt;

&lt;p&gt;It has the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multisite Drupal installations&lt;/li&gt;
&lt;li&gt;Boost module support&lt;/li&gt;
&lt;li&gt;&lt;a href="http://drupal.org/project/advagg"&gt;Advanced CSS/JS Aggregation&lt;/a&gt; support&lt;/li&gt;
&lt;li&gt;Supports fake CNAME-based cdns with imagecache and advagg (see &lt;a href="http://frontseed.com/entry/setting-cookieless-fake-cdns-drupal"&gt;previous post about null-session support on fake CDNs&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Proper MIME types for @font-face fonts&lt;/li&gt;
&lt;li&gt;An overall config file structure to minimize per-vhost file volume&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anyway feel free to add patches or comments: &lt;a href="https://github.com/attila/nginx_drupal"&gt;&lt;strong&gt;Drupal hosting on nginx&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/ojezWyv54E0" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/nginx-configuration-drupal-sites#comments</comments>
 <category domain="http://frontseed.com/tags/configuration">configuration</category>
 <category domain="http://frontseed.com/tags/drupal">Drupal</category>
 <category domain="http://frontseed.com/tags/nginx">Nginx</category>
 <category domain="http://frontseed.com/tags/php-fpm">php-fpm</category>
 <pubDate>Sat, 26 Mar 2011 17:44:25 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">30 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/nginx-configuration-drupal-sites</feedburner:origLink></item>
<item>
 <title>Setting up cookieless fake CDNs for Drupal</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/fIbYsxNbrSY/setting-cookieless-fake-cdns-drupal</link>
 <description>&lt;p&gt;So you want your Drupal site perform as quick as possible and you have set up CDN and patched imagecache and everything is working fine. Then you realize that any asynchronously generated static resource (e.g. image, stylesheet, etc.) will naturally send a session cookie to your visitors.&lt;/p&gt;

&lt;p&gt;The very promising &lt;a href="http://drupal.org/project/advagg"&gt;Advanced CSS/JS Aggregation&lt;/a&gt; and &lt;a href="http://drupal.org/project/imagecache"&gt;ImageCache&lt;/a&gt; both handle requests in a unique way: if the requested resource is not generated yet, it will run through Drupal, create the resource and place it in the path exactly where the request points to. This way, subsequent requests does not need to go through Drupal and PHP again, it can be served as a static resource.&lt;/p&gt;

&lt;p&gt;However since the first request runs through Drupal, it will start a session (Drupal 6 by default starts sessions for anonymous users) This is okay if you use a single domain to serve files from. Things get annoying when you start using alternate host names to speed up page loading times, and you realize that these precious alternate host names start sending out session cookies to your visitors, and you are basically doubling (or with 3 cname domains, that is quadrupling) your session rows if a visitor happens to hit a static resource for the first time.&lt;/p&gt;

&lt;p&gt;CDNs - even if they are just fake CNAME records pointing to the same webroot - should operate cookieless to keep the http request headers as short as possible for subsequent requests.&lt;/p&gt;

&lt;p&gt;One could (eliminate anonymous sessions)[http://2bits.com/articles/reducing-server-load-eliminating-anonymous-sessions-drupal-6x.html] easily from the entire site, but that might not be your cup of cake because anonymous sessions are needed so much say on an Ubercart site to track cart contents.&lt;/p&gt;

&lt;p&gt;My solution is to use an alternate session handler which in fact does not handle sessions at all. Configure this session handler to be fired only at your cdn domains and you're set to go.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://frontseed.com/entry/setting-cookieless-fake-cdns-drupal" target="_blank"&gt;read more&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/fIbYsxNbrSY" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/setting-cookieless-fake-cdns-drupal#comments</comments>
 <category domain="http://frontseed.com/tags/cdn">CDN</category>
 <category domain="http://frontseed.com/tags/drupal">Drupal</category>
 <category domain="http://frontseed.com/tags/imagecache">Imagecache</category>
 <category domain="http://frontseed.com/tags/session">session</category>
 <pubDate>Fri, 11 Mar 2011 23:06:35 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">28 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/setting-cookieless-fake-cdns-drupal</feedburner:origLink></item>
<item>
 <title>Using Drupal Imagecache with Lighttpd proxied Apache</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/kaa6mC9f0Dk/using-drupal-imagecache-lighttpd-proxied-apache</link>
 <description>&lt;p&gt;Using Lighttpd as a proxy for Apache is a popular solution to achieve smaller web server memory footprint and to speed up websites. However things can get messy when it comes to Drupal and the brilliant Imagecache module. Imagecache transforms images using presets and then caches them.&lt;/p&gt;

&lt;p&gt;An imagecache url is something like: &lt;code&gt;http://domain.tld/sites/default/files/imagecache/presetname/photo.jpg&lt;/code&gt;
This will take the the image placed at &lt;code&gt;sites/default/files/photo.jpg&lt;/code&gt; and transforms it according to &lt;code&gt;presetname&lt;/code&gt;. After succesful operation the image will be available as a static file at &lt;code&gt;sites/default/files/imagecache/presetname/photo.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;No need to say, this functionality breaks when the frontend web server only forwards requests to php files so imagecache images won't show up and will not be generated.&lt;/p&gt;

&lt;p&gt;One solution is: set up a separate subdomain to serve these images and redirect all imagecache images to this subdomain. This needs some simple LUA scripting, Lighttpd will forward an imagecache url if it hasn't created yet, and will serve it directly if it's already there.&lt;/p&gt;

&lt;p&gt;Four steps to get this working:&lt;/p&gt;

&lt;h3&gt;Configure Lighttpd&lt;/h3&gt;

&lt;p&gt;Create this little LUA script:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;
attr = lighty.stat(lighty.env['physical.path'])
if (not attr) then
   cuthere = string.find(lighty.env['uri.authority'], '.', 1, true) + 1
   redirhost = string.sub(lighty.env['uri.authority'], cuthere)
   lighty.header["Location"] = "http://" .. redirhost  .. 
lighty.env["request.orig-uri"]
   return 302
end
&lt;/pre&gt;

&lt;p&gt;This script will stat for the file requested and if not found, redirect the request to the main domain.
Link the lua script to the vhost configuration (and enable mod_magnet of course if you haven't done already):&lt;/p&gt;

&lt;pre class="brush:bash"&gt;magnet.attract-physical-path-to = ( "/etc/lighttpd/filecheckredirect.lua" )&lt;/pre&gt;

&lt;h3&gt;Set up the subdomain&lt;/h3&gt;

&lt;p&gt;Configure your subdomain or multiple subdomains for imagecache hosted images and set this in the Drupal settings.php:&lt;/p&gt;

&lt;pre class="brush:php"&gt;
/**
 * Alternate hosts for imagecache created images.
 * A string can be set for single hosts,
 * An array of hosts can be set for multiple hosts.
 */
$conf['static_file_hosts'] = array(
  'ic1.example.com',
  'ic2.example.com',
);
//$conf['static_file_hosts'] = 'ic.example.com';
&lt;/pre&gt;

&lt;h3&gt;Override imagecache theme function&lt;/h3&gt;

&lt;pre class="brush:php"&gt;
/**
 * Replace the domain part of imagecache urls with 'static_file_hosts' if
 * available.
 *
 * 'static_file_hosts' can be set from settings.php.
 */
function YOURTHEME_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
  // Check is_null() so people can intentionally pass an empty array of
  // to override the defaults completely.
  if (is_null($attributes)) {
    $attributes = array('class' =&gt; 'imagecache imagecache-'. $presetname);
  }
  if ($getsize &amp;&amp; ($image = image_get_info(imagecache_create_path($presetname, $path)))) {
    $attributes['width'] = $image['width'];
    $attributes['height'] = $image['height'];
  }
  $attributes = drupal_attributes($attributes);

  $domain = variable_get('static_file_hosts', $GLOBALS['base_url']);
  if (is_array($domain) &amp;&amp; !empty($domain)) {
    if (count($domain) &gt; 1) {
      $domain = $domain[rand(0, count($domain) - 1)];
    }
    else {
      $domain = $domain[0];
    }
  }
  if ($domain !== $GLOBALS['base_url']) {
    $base_url_parsed = parse_url($GLOBALS['base_url']);
    $imagecache_url = str_replace($GLOBALS['base_url'], $base_url_parsed['scheme'] . '://' . $domain, imagecache_create_url($presetname, $path));
  }
  else {
    $imagecache_url = imagecache_create_url($presetname, $path);
  }

  return '&amp;lt;img src="http://frontseed.com/%27.%20%24imagecache_url%20.%27" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' /&amp;gt;';
}
&lt;/pre&gt;

&lt;p&gt;&lt;a href="/sites/lab.frontseed.com/files/posts/20101110/template.php.txt"&gt;download&lt;/a&gt; this snippet.&lt;/p&gt;

&lt;h3&gt;Patch imagecache:&lt;/h3&gt;

&lt;p&gt;The patch below is for imagecache version 6.x-2.0-beta10:&lt;/p&gt;

&lt;pre class="brush:diff"&gt;
--- imagecache.module   19 Aug 2009 20:59:07 -0000  1.112.2.5
+++ imagecache.module 
@@ -318,7 +318,15 @@
   $args = array('absolute' =&gt; TRUE, 'query' =&gt; empty($bypass_browser_cache) ? NULL : time());
   switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
     case FILE_DOWNLOADS_PUBLIC:
-      return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
+      $domain = variable_get('static_file_hosts', $GLOBALS['base_url']);
+      if ($domain !== $GLOBALS['base_url']) {
+        if (is_array($domain) &amp;&amp; !empty($domain)) {
+          $domain = count($domain) &gt; 1 ? $domain[rand(0, count($domain) - 1)] : $domain[0];
+          $base_url_parsed = parse_url($GLOBALS['base_url']);
+          $domain = $base_url_parsed['scheme'] . '://' . $domain;
+        }
+      }
+      return url($domain . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
     case FILE_DOWNLOADS_PRIVATE:
       return url('system/files/imagecache/'. $presetname .'/'. $path, $args);
   }&lt;/pre&gt;

&lt;h3&gt;Final steps&lt;/h3&gt;

&lt;p&gt;Empty the theme registry and watch your imagecache files served from ic.example.com using Apache the first time and using Lighttpd after image generation.&lt;/p&gt;

&lt;h3&gt;Update&lt;/h3&gt;

&lt;p&gt;The solution above is only suitable in scenarios where a reverse proxy is used for static file handling.
I believe that planting a Lighttpd in front of Apache is not the best way to serve a Drupal page. According to my experience it is better to run either nginx as a reverse proxy or just have nginx handle all your pages via php-fpm. Or you can strip down Apache and use mpm_worker with php in fastcgi mode, however that is not my cup of tea either.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/kaa6mC9f0Dk" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/using-drupal-imagecache-lighttpd-proxied-apache#comments</comments>
 <category domain="http://frontseed.com/tags/apache">Apache</category>
 <category domain="http://frontseed.com/tags/drupal">Drupal</category>
 <category domain="http://frontseed.com/tags/imagecache">Imagecache</category>
 <category domain="http://frontseed.com/tags/lighttpd">Lighttpd</category>
 <pubDate>Wed, 10 Nov 2010 14:26:26 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">29 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/using-drupal-imagecache-lighttpd-proxied-apache</feedburner:origLink></item>
<item>
 <title>Enable frambeuffer on Ubuntu Karmic Koala using grub2</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/aD3-mFH0CtQ/enable-frambeuffer-ubuntu-karmic-koala-using-grub2</link>
 <description>&lt;p&gt;I usually develop and test my webpages on various VirtualBox virtual machines and since I am doing a lot of console work I use a framebuffer which enables using larger resolutions than the default console. 
Until now I was using Ubuntu 8.04 LTS virtual machines, but recently I upgraded to 9.10.
Ubuntu 9.10 (Karmic Koala) is using grub2 so the simple adding of &lt;code&gt;vga=791&lt;/code&gt; or similar value to boot options won't work. Here's how to enable the framebuffer on virtual consoles:&lt;/p&gt;

&lt;h3&gt;1. Enable kernel modules&lt;/h3&gt;

&lt;pre class="brush:bash"&gt;$ sudo nano /etc/initramfs-tools/modules&lt;/pre&gt;

&lt;p&gt;Add two lines at the end of the file enabling two kernel modules:&lt;/p&gt;

&lt;pre class="brush:xml"&gt;vesafb
fbcon&lt;/pre&gt;

&lt;p&gt;Prevent blacklisting the vesafb module:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo nano /etc/modprobe.d/blacklist-framebuffer.conf&lt;/pre&gt;

&lt;p&gt;Look for the line &lt;code&gt;blacklist vesafb&lt;/code&gt; and comment it out:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;#blacklist vesafb&lt;/pre&gt;

&lt;h3&gt;2. Modify grub configuration&lt;/h3&gt;

&lt;pre class="brush:bash"&gt;$ sudo nano /etc/default/grub&lt;/pre&gt;

&lt;p&gt;Remove the comment from the GRUB_GFXMODE line and set the desired resolution:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;GRUB_GFXMODE=1024x768&lt;/pre&gt;

&lt;p&gt;There's no need to set bit depth, just the screen resolution.
Then open the very first config file in /etc/grub.d&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo nano /etc/grub.d/00_header&lt;/pre&gt;

&lt;p&gt;Look for the code &lt;code&gt;  set gfxmode=${GRUB_GFXMODE}&lt;/code&gt; and insert one line after it so the code looks like this:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;
if loadfont `make_system_path_relative_to_its_root $(){GRUB_FONT_PATH}` ; then
  set gfxmode=${GRUB_GFXMODE}
  set gfxpayload=keep
  insmod gfxterm
  insmod ${GRUB_VIDEO_BACKEND}
&lt;/pre&gt;

&lt;h3&gt;3. Update your boot configuration&lt;/h3&gt;

&lt;pre class="brush:bash"&gt;$ sudo update-grub2

$ sudo update-initramfs -u&lt;/pre&gt;

&lt;p&gt;That's it! Now reboot and watch your enhanced virtual console with the framebuffer.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/aD3-mFH0CtQ" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/enable-frambeuffer-ubuntu-karmic-koala-using-grub2#comments</comments>
 <category domain="http://frontseed.com/tags/framebuffer">framebuffer</category>
 <category domain="http://frontseed.com/tags/grub2">grub2</category>
 <category domain="http://frontseed.com/tags/karmic-koala">Karmic Koala</category>
 <category domain="http://frontseed.com/tags/ubuntu">Ubuntu</category>
 <pubDate>Sat, 16 Jan 2010 12:59:27 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">25 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/enable-frambeuffer-ubuntu-karmic-koala-using-grub2</feedburner:origLink></item>
<item>
 <title>Installing Lighttpd with mod_deflate on Ubuntu Hardy</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/dfZPUozup48/installing-lighttpd-moddeflate-ubuntu-hardy</link>
 <description>&lt;p&gt;Meet &lt;a href="http://redmine.lighttpd.net/projects/lighttpd"&gt;Lighttpd&lt;/a&gt;: it is a fast, small footprint and higly configurable webserver with advanced features. It's often a common alternative to Apache. At the time of writing the latest versions from the 1.4.x branch is considered stable while &lt;a href="http://redmine.lighttpd.net/versions/show/3"&gt;Lighttpd 1.5.0&lt;/a&gt; is an ongoing work with new features.&lt;/p&gt;

&lt;p&gt;One new feature is the &lt;a href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_Deflate"&gt;mod_deflate&lt;/a&gt; server module which is a modified version of &lt;a href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModCompress"&gt;mod_compress&lt;/a&gt; shipped with 1.4.x versions. mod_deflate can compress any output from lighttpd static or dynamic - that is, lighttpd can compress the output of dynamically generated pages with this.&lt;/p&gt;

&lt;p&gt;Websites with lots of dynamically generated content receive significant bandwidth saving with dynamic output compression, and visitors of those websites benefit faster page loading times.&lt;/p&gt;

&lt;p&gt;There are patches available which makes building a version of Lighttpd 1.4.x from source which includes mod_deflate.&lt;/p&gt;

&lt;h3&gt;1. Building and packaging Lighttpd on Ubuntu&lt;/h3&gt;

&lt;p&gt;Before building on an Ubuntu hardy system, some prerequisites need to be installed. After getting lighttpd source, it needs to be patched to support mod_deflate. Standard debian packages are to be built which can be easily installed on any target system (assuming the same OS architecture)&lt;/p&gt;

&lt;p&gt;Install tools for building and get the Lighttpd source from the package repository:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo apt-get install build-essential fakeroot
$ sudo apt-get install debhelper cdbs libssl-dev libbz2-dev libattr1-dev libpcre3-dev libmysqlclient15-dev libgamin-dev libldap2-dev libfcgi-dev libgdbm-dev libmemcache-dev liblua5.1-0-dev dpatch patchutils pkg-config uuid-dev libsqlite3-dev libxml2-dev libkrb5-dev
$ mkdir ~/lighttpd
$ cd ~/lighttpd
$ apt-get source lighttpd&lt;/pre&gt;

&lt;p&gt;Download the patch and apply it:&lt;/p&gt;

&lt;pre class="brush:xml"&gt;$ wget http://redmine.lighttpd.net/attachments/download/632/lighttpd-1.4.19.mod_deflate.patch
$ cd lighttpd-1.4.19
$ patch -p1 &amp;lt; ../lighttpd-1.4.19.mod_deflate.patch&lt;/pre&gt;

&lt;p&gt;Build and install the package:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ fakeroot dpkg-buildpackage&lt;/pre&gt;

&lt;p&gt;After building completes you will see the freshly built deb packages in the parent directory:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ cd ..
$ ls -lgG
total 1336
drwxr-xr-x 8   4096 Aug 16 08:05 lighttpd-1.4.19
-rw-r--r-- 1  66387 Oct  8  2008 lighttpd-1.4.19.mod_deflate.patch
-rw-r--r-- 1  70422 Aug 16 08:07 lighttpd-doc_1.4.19-0ubuntu3_all.deb
-rw-r--r-- 1  11536 Aug 16 08:08 lighttpd-mod-cml_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1  10958 Aug 16 08:08 lighttpd-mod-magnet_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1   6918 Aug 16 08:08 lighttpd-mod-mysql-vhost_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1   8492 Aug 16 08:08 lighttpd-mod-trigger-b4-dl_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1  19002 Aug 16 08:08 lighttpd-mod-webdav_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1  38501 Aug 16 08:03 lighttpd_1.4.19-0ubuntu3.diff.gz
-rw-r--r-- 1   1106 Aug 16 08:03 lighttpd_1.4.19-0ubuntu3.dsc
-rw-r--r-- 1   2433 Aug 16 08:08 lighttpd_1.4.19-0ubuntu3_i386.changes
-rw-r--r-- 1 267770 Aug 16 08:08 lighttpd_1.4.19-0ubuntu3_i386.deb
-rw-r--r-- 1 815568 Mar 12  2008 lighttpd_1.4.19.orig.tar.gz&lt;/pre&gt;

&lt;p&gt;Lighttpd depends on &lt;code&gt;libterm-readline-perl-perl&lt;/code&gt; so install this as well:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo apt-get install libterm-readline-perl-perl&lt;/pre&gt;

&lt;p&gt;If apt-get is whining about &lt;code&gt;libterm-readkey-perl&lt;/code&gt; as a dependency try:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo apt-get -f install libterm-readkey-perl libterm-readline-perl-perl&lt;/pre&gt;

&lt;p&gt;Then you can install lighttpd from the freshly built deb package:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo dpkg -i lighttpd_1.4.19-0ubuntu3_i386.deb&lt;/pre&gt;

&lt;p&gt;If you need additional packages, install them as well:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo dpkg -i lighttpd-mod-magnet_1.4.19-0ubuntu3_i386.deb
$ sudo dpkg -i lighttpd-mod-webdav_1.4.19-0ubuntu3_i386.deb&lt;/pre&gt;

&lt;p&gt;Copy mod_deflate module to its place:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo cp -d ~/lighttpd/lighttpd-1.4.19/debian/tmp/usr/lib/lighttpd/mod_deflate.so* /usr/lib/lighttpd/&lt;/pre&gt;

&lt;h3&gt;2. Configuring mod_deflate&lt;/h3&gt;

&lt;p&gt;Load the module in &lt;code&gt;/etc/lighttpd/lighttpd.conf&lt;/code&gt;and comment out &lt;code&gt;mod_compress&lt;/code&gt;:&lt;/p&gt;

&lt;pre class="brush:bash; first-line:11;"&gt;    server.modules = (
                "mod_access",
                "mod_alias",
                "mod_accesslog",
    #           "mod_compress",
                "mod_deflate",
    #           "mod_rewrite",
    #           "mod_redirect",
    &lt;/pre&gt;

&lt;p&gt;Also comment out &lt;code&gt;mod_compress&lt;/code&gt; configuration directives:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;    #### compress module
    #compress.cache-dir          = "/var/cache/lighttpd/compress/"
    #compress.filetype           = ("text/plain", "text/html", "application/x-javascript", "text/css")&lt;/pre&gt;

&lt;p&gt;Configure the mod_deflate module:&lt;/p&gt;

&lt;pre class="brush:bash; first-line:11;"&gt;    # mod_deflate settings
    deflate.enabled = "enable"
    deflate.compression-level = 9
    deflate.mem-level = 9
    deflate.window-size = 15
    deflate.bzip2 = "enable"
    deflate.min-compress-size = 200
    #deflate.sync-flush = "enable"
    deflate.output-buffer-size = 4096
    deflate.work-block-size = 512
    deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml")
    deflate.debug = "enable"&lt;/pre&gt;

&lt;p&gt;Detailed information about configuration options is available on the &lt;a href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_Deflate"&gt;Lighttpd mod_deflate documentation page&lt;/a&gt;.
The last line is only to check if mod_deflate is working.&lt;/p&gt;

&lt;p&gt;Fire up Lighttpd:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo /etc/init.d/lighttpd start&lt;/pre&gt;

&lt;p&gt;Visit a static page: http://your.server/index.lighttpd.html and check the lighttpd error log at &lt;code&gt;/var/log/lighttpd/error.log&lt;/code&gt;:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;2009-08-16 09:27:22: (mod_deflate.c.1232) Content-Type: text/html
2009-08-16 09:27:22: (mod_deflate.c.1239) mime-type: text/html
2009-08-16 09:27:22: (mod_deflate.c.1267) enable compression for  /index.lighttpd.html
2009-08-16 09:27:22: (mod_deflate.c.1283) add Vary: Accept-Encoding for  /index.lighttpd.html
2009-08-16 09:27:22: (mod_deflate.c.305) output-buffer-size: 4096
2009-08-16 09:27:22: (mod_deflate.c.307) compression-level: 9
2009-08-16 09:27:22: (mod_deflate.c.309) mem-level: 9
2009-08-16 09:27:22: (mod_deflate.c.311) window-size: -15
2009-08-16 09:27:22: (mod_deflate.c.313) min-compress-size: 200
2009-08-16 09:27:22: (mod_deflate.c.315) work-block-size: 512
2009-08-16 09:27:22: (mod_deflate.c.1350) Compress all content and use Content-Length header: uncompress len= 3574
2009-08-16 09:27:22: (mod_deflate.c.948) compress: in_queue len= 3574
2009-08-16 09:27:22: (mod_deflate.c.881) compress file chunk: offset= 0 , toSend= 3574
2009-08-16 09:27:22: (mod_deflate.c.351) gzip_header len= 10
2009-08-16 09:27:22: (mod_deflate.c.386) compress: in= 3574 , out= 0
2009-08-16 09:27:22: (mod_deflate.c.1003) compressed bytes: 3574
2009-08-16 09:27:22: (mod_deflate.c.451) flush: in= 0 , out= 1555
2009-08-16 09:27:22: (mod_deflate.c.489) gzip_footer len= 8
2009-08-16 09:27:22: (mod_deflate.c.919)  in: 3574  out: 1563
2009-08-16 09:27:22: (mod_deflate.c.1020) finished uri: /index.lighttpd.html , query:&lt;/pre&gt;

&lt;h3&gt;3. Install and configure php for Lighttpd&lt;/h3&gt;

&lt;p&gt;Install the CGI version of PHP&lt;/p&gt;

&lt;pre class="brush:bash"&gt;$ sudo apt-get install php5-cgi
$ sudo lighty-enable-mod fastcgi&lt;/pre&gt;

&lt;p&gt;Place a php file named info.php file in your server root directory:&lt;/p&gt;

&lt;pre class="brush:php"&gt;&amp;lt;?php phpinfo(); ?&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now visit http://your.server/info.php and check the log:&lt;/p&gt;

&lt;pre class="brush:bash"&gt;2009-08-16 09:34:56: (mod_deflate.c.1232) Content-Type: text/html
2009-08-16 09:34:56: (mod_deflate.c.1239) mime-type: text/html
2009-08-16 09:34:56: (mod_deflate.c.1267) enable compression for  /info.php
... snip ...
2009-08-16 09:34:56: (mod_deflate.c.919)  in: 42054  out: 7057
2009-08-16 09:34:56: (mod_deflate.c.1020) finished uri: /info.php , query:&lt;/pre&gt;

&lt;p&gt;That's it. If it works, be sure to comment out &lt;code&gt;deflate.debug&lt;/code&gt; in lighttpd.conf as it's generating a fairly large amount of entries in your server log.&lt;/p&gt;

&lt;h3&gt;Caveats&lt;/h3&gt;

&lt;p&gt;mod_deflate doesn't support caching compressed files in a directory like mod_compress does. This means that every http request matching a configured mime-type will trigger mod_deflate compression. This usually produces higher cpu utilization in favor of lower bandwidth usage. If you experience high cpu load, try lowering the &lt;code&gt;deflate.compression-level&lt;/code&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/dfZPUozup48" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/installing-lighttpd-moddeflate-ubuntu-hardy#comments</comments>
 <category domain="http://frontseed.com/tags/hardy">Hardy</category>
 <category domain="http://frontseed.com/tags/lighttpd">Lighttpd</category>
 <category domain="http://frontseed.com/tags/moddeflate">mod_deflate</category>
 <category domain="http://frontseed.com/tags/ubuntu">Ubuntu</category>
 <pubDate>Sun, 16 Aug 2009 08:16:50 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">26 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/installing-lighttpd-moddeflate-ubuntu-hardy</feedburner:origLink></item>
<item>
 <title>Using Bazaar for web development on Ubuntu Hardy</title>
 <link>http://feedproxy.google.com/~r/frontseed/lab/~3/s9MfWEmM1uA/using-bazaar-web-development-ubuntu-hardy</link>
 <description>&lt;p&gt;&lt;a href="http://bazaar-vcs.org/"&gt;Bazaar&lt;/a&gt; is a nice version control system for me, it allows to keep my project directory versioned &lt;a href="http://bazaar-vcs.org/BazaarForWebDevs" title="Bazaar in five minutes for web devs"&gt;without much fiddling&lt;/a&gt; with the vcs-savvy stuff.&lt;/p&gt;

&lt;h3&gt;1. Get updated version of Bazaar&lt;/h3&gt;

&lt;p&gt;On Ubuntu 8.04 LTS (hardy) the bazaar packages are kind of outdated, but there is a simple solution. The &lt;a href="https://launchpad.net/~bzr/+archive/ppa"&gt;PPA for Bazaar Developers&lt;/a&gt; is a Launchpad project but it contains package repositories for all supported Ubuntu systems.&lt;/p&gt;

&lt;p&gt;To get the packages jut edit &lt;code&gt;/etc/apt/sources.list.d/sources.list&lt;/code&gt;, add the following lines:&lt;/p&gt;

&lt;pre class="brush:shell"&gt;deb http://ppa.launchpad.net/bzr/ppa/ubuntu hardy main
deb-src http://ppa.launchpad.net/bzr/ppa/ubuntu hardy main&lt;/pre&gt;

&lt;p&gt;You can subsitute hardy with your ubuntu version if it's supported.
Add the OpenPGP key id for the repository:&lt;/p&gt;

&lt;pre class="brush:shell"&gt;$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C6C1EFD &lt;/pre&gt;

&lt;p&gt;Be sure to check the proper key-id of the repository. At the time of writing this is &lt;code&gt;8C6C1EFD&lt;/code&gt;.
Note: apt-key needs the &lt;em&gt;gnupg&lt;/em&gt; package to do this.&lt;/p&gt;

&lt;p&gt;Then update and install the new versions:&lt;/p&gt;

&lt;pre class="brush:shell"&gt;$ sudo apt-get update
$ sudo apt-get install bzr bzrtools&lt;/pre&gt;

&lt;h3&gt;2. Get the bzr upload plugin&lt;/h3&gt;

&lt;p&gt;&lt;cite&gt;The bzr-upload plugin incrementally uploads changes to a dumb server.
Web sites are often hosted on servers where bzr can't be installed. In other cases, the web site must not give access to its corresponding branch (for security reasons for example). Finally, web hosting providers often provides only ftp access to upload sites.
This plugin uploads only the relevant changes since the last upload using ftp or sftp protocols.&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;The bzr-upload is not available as a package for Hardy. Luckily, installing this is really easy, just type:&lt;/p&gt;

&lt;pre class="brush:shell"&gt;$ mkdir -p ~/.bazaar/plugins
$ bzr co lp:bzr-upload ~/.bazaar/plugins/upload&lt;/pre&gt;

&lt;p&gt;The plugin is instantly available for use after checking out. Now you can use the plugin via:&lt;/p&gt;

&lt;pre class="brush:shell"&gt;$ bzr upload sftp://username@server:22/~/sites/my.coolsite.com/
$ bzr upload --auto&lt;/pre&gt;

&lt;p&gt;See &lt;code&gt;bzr help upload&lt;/code&gt; for detailed usage information.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/frontseed/lab/~4/s9MfWEmM1uA" height="1" width="1"/&gt;</description>
 <comments>http://frontseed.com/entry/using-bazaar-web-development-ubuntu-hardy#comments</comments>
 <category domain="http://frontseed.com/tags/bzr">bzr</category>
 <category domain="http://frontseed.com/tags/development">Development</category>
 <category domain="http://frontseed.com/tags/hardy">Hardy</category>
 <category domain="http://frontseed.com/tags/ubuntu">Ubuntu</category>
 <pubDate>Sat, 15 Aug 2009 11:13:09 +0000</pubDate>
 <dc:creator>Attila</dc:creator>
 <guid isPermaLink="false">27 at http://frontseed.com</guid>
<feedburner:origLink>http://frontseed.com/entry/using-bazaar-web-development-ubuntu-hardy</feedburner:origLink></item>
</channel>
</rss>

