Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

lighttpd support

Open jon-daemon opened this issue 1 year ago • 5 comments

Is it possible to include a conf file for lighttpd server? I already have lighttpd installed for pihole on a device with very low resources and I'd like to use that for part-db too.

jon-daemon avatar Feb 04 '24 11:02 jon-daemon

If lighttpd is already configured to use PHP, it should not be too difficult to use Part-DB with it. Basically you just need to add a new vhost definition in lighttpd, pointing the the correct document root and adding the required rewrite routes.

Something like this should work

$HTTP["host"] =~ "myhost\.tld" { 
    server.document-root = "/var/www/partdb/public" 
    accesslog.filename = "/var/log/lighttpd/partdb_access.log;" 
    url.rewrite-if-not-file = ( 
        "^/$" => "$0", 
        "^/(?!.+\.php)[^\?]+(\?.*)?" => "index.php/$1$2", 
    ) 
}

jbtronics avatar Feb 04 '24 13:02 jbtronics

@jbtronics I think you made some typos in the above, such as ';' at end of partdb_access.log. I think you meant

$HTTP["host"] == "myhost.tld" {
    server.document-root = "/var/www/partdb/public"
    accesslog.filename = "/var/log/lighttpd/partdb_access.log"
    url.rewrite-if-not-file = (
        "^/(?!index.php)[^\?]" => "/index.php/${url.path}${qsa}",
    )
}

https://wiki.lighttpd.net/mod_rewrite

gstrauss avatar Feb 07 '24 08:02 gstrauss

Thats possible. I basically copied this config snippet and modified it slightly on phone, so its possible that it contains some typos. I have not tested it. So somebody who used lighttpd should give it try and give feedback if it work with that config.

jbtronics avatar Feb 07 '24 11:02 jbtronics

From where did you copy that config snippet? I would like to get that corrected. Thanks.

gstrauss avatar Feb 08 '24 06:02 gstrauss

Not from the official lighthttpd documentation. I think it was from another open source project who uses symfony. It was used for an old symfony version though, so i had to slightly modify it.

In general it seems that running a symfony application with lighttpd is not so common. I were not able to find much info about that (even though i would think that the correct PHP and rewrite config should be enought)

jbtronics avatar Feb 08 '24 09:02 jbtronics