Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
4 total  XML / RSS feed 

LightTPD subdomain rewrite, Backpack/Basecamp style.

Rewrites test.example.com/example/path/ to example.com/test/example/path/

This example show the values being passed to FCGI for use by Django.


$HTTP["host"] =~ "([^.]+)\.example\.com" {
  server.document-root = "/users/home/username/domains/example.com/web/public"
  server.errorlog = "/users/home/username/var/log/lighttpd.example_com.error.log" 
  accesslog.filename = "/users/home/username/var/log/lighttpd.example_com.access.log" 

  fastcgi.server = (
    "/main.fcgi" => (
      "main" => (
        "socket" => "/users/home/username/tmp/django/example_com.socket"
      )
    )
  )

  url.rewrite-once = ( "^(/.*)$" => "/main.fcgi/%1/$1" )
  server.error-handler-404 = "/main.fcgi" 
}

Lighttpd conditional for subdomain

$HTTP["host"] =~ "(typo|blog)\.simplicio\.(com|net|org)" {
server.document-root = "/home/rsimplicio/web/public/typo/"

url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
  server.error-handler-404 = "/dispatch.fcgi" 
server.indexfiles = ( "dispatch.fcgi")

 fastcgi.server = ( ".fcgi" =>
   ( "Simplicio-typo" =>
        (
          "socket"   => "/home/rsimplicio/web/lighttpd-typo-fcgi.socket",
          "bin-path" => "/home/rsimplicio/web/public/typo/dispatch.fcgi",
          "bin-environment" => ( "RAILS_ENV" => "production" ),
          "max-load-per-proc" => 25,
          "min-procs" => 1,
          "max-procs" => 1,
          "idle-timeout" => 60
        )
    )
  ) 
}

DiG for gtcaz2

dig @dns1.textdrive.com cheshirelaw.textdriven.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com cheshirelaw.textdriven.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12577
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cheshirelaw.textdriven.com. IN A

;; ANSWER SECTION:
cheshirelaw.textdriven.com. 2400 IN A 207.7.108.242

;; Query time: 39 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:55:01 2005
;; MSG SIZE rcvd: 60

DiG for gtcaz

dig @dns1.textdrive.com cheshirelaw.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com cheshirelaw.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57856
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cheshirelaw.com. IN A

;; Query time: 38 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:51:25 2005
;; MSG SIZE rcvd: 33
« Newer Snippets
Older Snippets »
4 total  XML / RSS feed