title: Lighttpd and cgi python
body: <p>I'm trying to execute some python scripts through lighttpd but when I try to run it, I only get a blank file which I'm asked to download.</p>
  
  <p><em>lighttpd.conf</em></p>
  
  <pre><code>server.modules  = (
              "mod_access",
              "mod_alias",
              "mod_accesslog",
              "mod_compress",
              "mod_rewrite"
  )
  
  server.port                 = 8080
  server.bind                 = "127.0.0.1"
  server.document-root        = "/var/www"
  server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
  server.errorlog             = "/var/log/lighttpd/error.log"
  server.pid-file             = "/var/run/lighttpd.pid"
  server.username             = "www-data"
  server.groupname            = "www-data"
  
  
  
  index-file.names            = ( "index.php", "index.html",
                                  "index.htm", "default.htm",
                                 " index.lighttpd.html" )
  
  
  url.access-deny             = ( "~", ".inc" )
  
  static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" )
  
  dir-listing.encoding        = "utf-8"
  server.dir-listing          = "enable"
  
  compress.cache-dir          = "/var/cache/lighttpd/compress/"
  compress.filetype           = ( "application/x-javascript", "text/css", "text/html", "text/plain" )
  
  include_shell "/usr/share/lighttpd/create-mime.assign.pl"
  include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
  </code></pre>
  
  <p><em>/etc/lighttpd/conf-enabled/10.cgi.conf</em></p>
  
  <pre><code>server.modules += ( "mod_cgi" )
  
  $HTTP["url"] =~ "^/cgi-bin/" {
      cgi.assign = ( "" =&gt; "" )
  }
  
  ## Warning this represents a security risk, as it allow to execute any file
  ## with a .pl/.py even outside of /usr/lib/cgi-bin.
  #
  cgi.assign      = (
  #   ".pl"  =&gt; "/usr/bin/perl",
      ".py"  =&gt; "/usr/bin/python"
  )
  </code></pre>
  
  <p><em>/var/www/cgi-bin/hellopy.py</em></p>
  
  <pre><code>print "Content-Type: text/html"
  print
  print "&lt;TITLE&gt;CGI script output&lt;/TITLE&gt;"
  print "&lt;H1&gt;This is my first CGI script&lt;/H1&gt;"
  print "Hello, world!"
  </code></pre>
  
  <p>I really don't understand what's happening.</p>