Skip to content

Instantly share code, notes, and snippets.

@havvg
Created November 7, 2010 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havvg/665879 to your computer and use it in GitHub Desktop.
Save havvg/665879 to your computer and use it in GitHub Desktop.
lighttpd symfony configuration w/ file existence lookup
server.modules += ("mod_rewrite", "mod_magnet")
$HTTP["host"] =~ "(^|\.)your-domain\.com$" {
server.document-root = "/var/www/your-domain.com/web"
server.errorlog = "/var/log/lighttpd/your-domain.com/error.log"
accesslog.filename = "/var/log/lighttpd/your-domain.com/access.log"
include "symfony.conf"
}
attr = lighty.stat(lighty.env['physical.path'])
if (not attr) then
lighty.env['uri.path'] = '/index.php'
lighty.env['physical.rel-path'] = lighty.env['uri.path']
lighty.env['physical.path'] = lighty.env['physical.doc-root'] .. lighty.env['physical.rel-path']
end
url.rewrite-once = (
"^/(.*)\.(.*)" => "$0",
"^/([^.]+)$" => "/index.php/$1",
"^/$" => "/index.php"
)
magnet.attract-physical-path-to = ( "/etc/lighttpd/rewrite.lua" )
@AnnoyingTechnology
Copy link

As of lighttpd 1.4.x the existence file lookup is simpler with url.rewrite-if-not-file

url.rewrite-if-not-file = (
        "^/$" => "$0",
        "^/(?!.+\.php)[^\?]+(\?.*)?" => "app.php/$1$2",
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment