$HTTP["host"] =~ "^(www\.)?rc\.vc|85\.17\.184\.(215|214)" {
  var.servername = "rc.vc"
  include "incl-docroot.conf"

  # Force things in our /config/files directory to serve as plain text
  $HTTP["url"] =~ "^/files/" {
    $HTTP["url"] !~ "^/files/ipod/firmware" {
      mimetype.assign += ( ".pl" => "text/plain" )
      static-file.exclude-extensions = ( ) 
      cgi.assign = ( )
      # Source viewing
      url.rewrite-once = ( 
        "^/files/(.*\.pl)$" => "/codeview.php?file=$1",
        "^/files/(.*\.php)$" => "/codeview.php?file=$1",
        "^/files/(.*\.css)$" => "/codeview.php?file=$1",
        "^/files/(.*\.sh)$" => "/codeview.php?file=$1"
      )
    }
  }

  # Some redirects
  url.redirect = ( 
    # Projects that now have their own Trac
    "^/files/irssi/scripts/twitter.pl$" => "/trac/twitter-irssi",

    # Make sure the wiki users get the right page
    "^/wiki/db/*" => "/wiki/wiki.pl",
    "^/wiki/$" => "/wiki/wiki.pl"
  )

  auth.backend = "htpasswd"
  auth.backend.htpasswd.userfile = "/var/www/htdocs/data/.htpasswd"

  # Make sure our URL log requires a password
  auth.require = ( "/share/" =>
                   (
                     "method"  => "basic",
                     "realm"   => "Restricted Area",
                     "require" => "valid-user"
                   ),
		   "/RPC2" =>
 			(
			  "method" => "basic",
			  "realm" => "XML-RPC",
			  "require" => "valid-user"
			 )
		)

  scgi.server = (
	 "/RPC2" => # RT_DIR
	  ( "127.0.0.1" =>
	   (
	    "host" => "127.0.0.1", # Ip where rtorrent is listening
	    "port" => 5000, # Port specified in .rtorrent.rc
	    "check-local" => "disable"
	   )
	  )
	 )

  ############
  # Trac setup
  ############
  alias.url            = (
      "/trac/chrome/common/" => "/usr/share/trac/htdocs/",
  )

  # rewrite for multiple svn project
  url.rewrite-final    = (
      "^/trac/[^/]+/chrome/common/(.*)" => "/trac/chrome/common/$1",
  )

  $HTTP["url"] =~ "^/trac/chrome/" {
      # no fastcgi
  } else $HTTP["url"] =~ "^/trac" {
        fastcgi.server    = (
            "/" => (
                (
                    "bin-path"        => "/usr/share/webapps/trac/0.10.5/hostroot/cgi-bin/trac.fcgi",
                    "socket"          => "/tmp/trac.sock",
                    "check-local"     => "disable",
                    "disable-time"    => 1,
                    "min-procs"       => 1,
                    "max-procs"       => 1,
                    "bin-environment" => (
                    "TRAC_ENV_PARENT_DIR" => "/var/lib/trac/",
                    "PYTHON_EGG_CACHE" => "/var/tmp/trac"
                    ),
                ),
            ),
        )
  }
  
  $HTTP["url"] =~ "^/trac/[^/]+/login" {
    auth.require    = ( "/" =>
                       ( "method" => "basic",
                         "realm" => "rc.vc Subversion repository",
                         "require" => "user=remco"
                       )
                      )
  }
}

$HTTP["host"] =~ "vn\.rc\.vc" {
  var.subdomain = "vn"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "m\.rc\.vc" {
  var.subdomain = "m"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "dj\.rc\.vc" {
  var.subdomain = "dj"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "i\.rc\.vc" {
  var.subdomain = "i"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "t\.rc\.vc" {
  var.subdomain = "t"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "p\.rc\.vc" {
  var.subdomain = "p"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "pf\.rc\.vc" {
  var.subdomain = "pf"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "fb\.rc\.vc" {
  var.subdomain = "fb"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"
}

$HTTP["host"] =~ "to\.rc\.vc" {
  var.subdomain = "to"
  var.servername = "rc.vc"
  include "incl-docsubroot.conf"

  auth.backend = "htpasswd"
  auth.backend.htpasswd.userfile = "/var/www/htdocs/data/.htpasswd"

  # Make sure our URL log requires a password
  auth.require = ( "/" =>
                   (
                     "method"  => "basic",
                     "realm"   => "Restricted Area",
                     "require" => "valid-user"
                   )
                )
}

