title: lighttpd + mod_fastcgi + django
body: <p>I am having trouble deploying my django app to a server that uses lighttpd (on which I'm root.)</p>
  
  <p>Here's my <code>lighttpd.conf</code>:</p>
  
  <pre><code>server.modules = (
  #       "mod_access",                                                                                                                                                                
  #       "mod_alias",                                                                                                                                                                 
  #               "mod_compress",                                                                                                                                                      
  #       "mod_redirect",                                                                                                                                                              
          "mod_status",
          #"mod_rewrite",                                                                                                                                                              
          #       "mod_fastcgi",                                                                                                                                                       
  #       "mod_accesslog",                                                                                                                                                             
  )
  
  status.status-url          = "/server-status"
  status.config-url          = "/server-config"
  
  $HTTP["host"] == "myurl.com" {
  server.document-root = "/var/www/myurl"
  server.errorlog = "/var/log/lighttpd/myurl/error.log"
  accesslog.filename = "var/log/lighttpd/nixcraft/access.log"
  server.error-handler-404 = "/e404.html"
  
  fastcgi.server = (
      "/myurl/nonorientable.fcgi" =&gt; (
          "main" =&gt; (
              # Use host / port instead of socket for TCP fastcgi                                                                                                                      
              # "host" =&gt; "127.0.0.1",                                                                                                                                                 
              # "port" =&gt; 3033,                                                                                                                                                        
              "socket" =&gt; "/tmp/myurl.sock",
              "check-local" =&gt; "disable",
          )
      ),
  )
  }
  
  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")
  
  url.access-deny             = ( "~", ".inc" )
  
  static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
  
  
  ## Use ipv6 if available                                                                                                                                                             
  #include_shell "/usr/share/lighttpd/use-ipv6.pl"                                                                                                                                     
  
  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"
  
  server.modules += ( "mod_auth" )
  auth.debug = 2
  auth.backend = "plain"
  auth.backend.plain.userfile = "/etc/lighttpd/.lighttpdpassword"
  
  auth.require = ( "/" =&gt;
  ("method" =&gt; "basic",
   "realm" =&gt; "",
   "require" =&gt; "user=john"))
  </code></pre>
  
  <p>And then I ran this on my server (from the folder <code>/var/www/myurl</code>):
  <code>sudo python manage.py runfcgi daemonize=false socket=/tmp/myurl.sock maxrequests=1</code></p>
  
  <p>At this point, when I try to load myurl.com, all I get is the directory listing: my django app is not executed. I thought that the problem was that <code>mod_fastcgi</code> is commented in my conf, it actually appears on myurl.com/server-config. If I uncomment it, lighttpd complains that I'm trying to load the same module twice and exits, so my guess is that it is imported by default.</p>
  
  <p>I'm using django1.4 (latest stable) and lighttpd 1.4.28 on ubuntu 12.04, and I'm pretty stuck. I followed the official doc (https://docs.djangoproject.com/en/1.4/howto/deployment/fastcgi/)</p>