[Twisted-web] documentation -- Techno Turkey's fifth adventure

Valentino Volonghi aka Dialtone dialtone at divmod.com
Mon Jul 17 18:40:55 CDT 2006


On Mon, 17 Jul 2006 16:54:18 -0200, Manlio Perillo <manlio_perillo at libero.it> wrote:
>An interesting question is:
>when one should consider the option of serving static content with a
>server like lighttpd, and forward with mod_proxy requests for dynamic
>content to twisted web?

Fairly easy. Just be sure that all the static content is served from a known (or many _known_) urls like: /static/...

Thus you can use the following rule:

$HTTP["host"] =~ "^(testing.stiq.it|localhost)$" {
        url.rewrite-once = (
		"^/static/.*" => "$0",
                "^/favicon.ico$" => "/static/$0",
		"^/(.*)" => "/vhost/http/%0/$1"
	)
	$HTTP["url"] !~ "^/(static/|favicon.ico)" {
            proxy.server = ( "" =>
                ( (
                    "host" => "127.0.0.1",
                    "port" => 8080
                ) )
            )
	}
	server.document-root = "/usr/local/src/repos/stiq/"
}

Given the rewrite rule urls are rewritten once and then matched to see if
the request should be proxied or served by lighttpd from the document root.



More information about the Twisted-web mailing list