<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Fun with ones and zeros - lighttpd</title>
<subtitle>Barry&#039;s notes on computer software and hardware</subtitle>
<link href="/blog/tags/lighttpd"></link>
<updated>2026-05-28T05:50:13-07:00</updated>
<id>urn:uuid:1e7bf72d-ef93-7cd7-2889-d1c0d92af4e6</id>
<entry>
<title>Getting PyBlosxom SCGI working under Lighttpd</title>
<link href="/blog/entries/lighttpd_scgi_pyblosxom"></link>
<id>urn:uuid:f080ae96-dab4-1408-4bcc-d5600bead837</id>
<updated>2006-01-17T09:13:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;Took another whack at getting PyBlosxom/SCGI working with &lt;a href=&quot;http://www.lighttpd.net&quot;&gt;Lighttpd&lt;/a&gt;, 
   this time with better success. (I&#039;m still getting up-to-speed with Lighttpd).  This is working with the 
   exact same SCGI setup I was &lt;a href=&quot;http://barryp.org/blog/python/pyblosxom_scgi.html&quot;&gt;working on the other day&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;To elaborate a bit, the setup I&#039;m trying to achieve is to:
&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;
     Have the blog to be completely under &amp;quot;&lt;code&gt;/blog/&lt;/code&gt;&amp;quot; in the URL namespace
 &lt;/li&gt;

 &lt;li&gt;
     Not get it confused with anything else that begins with &amp;quot;/blog&amp;quot; such as &amp;quot;/blog2&amp;quot;.
 &lt;/li&gt;

 &lt;li&gt;
     Use &amp;quot;&lt;code&gt;/blog/static/&lt;/code&gt;&amp;quot; URLs for serving static resources like CSS stylesheets 
  and images off the disk (instead of running those requests through PyBlosxom&#039;s CGI code).
 &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is what I ended up with, seems to work fairly well, and I&#039;m impressed with how Lighttpd makes
   it easy to put together a understandable configuration.
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#
# External redirection to add a trailing &amp;quot;/&amp;quot; if exactly 
# &amp;quot;/blog&amp;quot; is requested
#
url.redirect = (
                &amp;quot;^/blog$&amp;quot; =&amp;gt; &amp;quot;http://barryp.org:81/blog/&amp;quot;,
               )

#
# The PyBlosxom Blog, lives under the &amp;quot;/blog/&amp;quot; url namespace
#
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/blog/&amp;quot; {
    #
    # Static resources served from the disk
    #
    $HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/blog/static/&amp;quot; {
        alias.url = (&amp;quot;/blog/static/&amp;quot; =&amp;gt; &amp;quot;/data/blog/static/&amp;quot;)
    }

    #
    # Everything non-static goes through SCGI
    #
    $HTTP[&amp;quot;url&amp;quot;] !~ &amp;quot;^/blog/static/&amp;quot; {
        scgi.server = ( &amp;quot;/blog&amp;quot; =&amp;gt; (
                                     (
                                     &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;127.0.0.1&amp;quot;,
                                     &amp;quot;port&amp;quot; =&amp;gt; 8040,
                                     &amp;quot;check-local&amp;quot; =&amp;gt; &amp;quot;disable&amp;quot;,
                                     )
                                   )
        )
    }
}
&lt;/code&gt;&lt;/pre&gt;

</content>
</entry>
<entry>
<title>Lighttpd matching default virtual hosts.</title>
<link href="/blog/entries/lighttpd_458"></link>
<id>urn:uuid:db517505-2d2d-c4b9-2198-e0dab3f4cedb</id>
<updated>2006-01-14T09:36:23-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;
While taking a look at &lt;a href=&quot;http://www.lighttpd.net/&quot;&gt;Lightttpd&lt;/a&gt;, found that
it didn&#039;t seem possible to setup a condition that only acted if a host wasn&#039;t specified
in the request header. 
Filed ticket &lt;a href=&quot;http://trac.lighttpd.net/trac/ticket/458&quot;&gt;458&lt;/a&gt; 
in the Lighttpd Trac, so that a config could use
&lt;/p&gt;
&lt;pre&gt;
$HTTP[&quot;host&quot;] == &quot;&quot;
&lt;/pre&gt;
&lt;p&gt;
Currently, a non-specified host is stored as a NULL, and comparisons to NULL always fail.
&lt;/p&gt;
&lt;p&gt;
Otherwise Lighttpd seems fairly decent, and has some advantages to running CGIs in that
you can easily suexec them to run under other userids.  Apache only seems to want to
do that for virtual hosts or personal user folders - not arbitrary CGIs in non-user folders.
&lt;/p&gt;



</content>
</entry>
</feed>