Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Jan 6, 2017

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
You can’t perform that action at this time.