I'm trying to set mimetypes for files at a specific path on my server, which is running lighttpd version 1.4.31 with SSL.

I'm following this documentation of configuration: http://redmine.lighttpd.net/projects/1/wiki/docs_configuration

Specifying $PHYSICAL["path"] isn't featured until lighttpd version 1.5.0, so I'm trying to specify $HTTP["url"].

I have tried both

$HTTP["url"] == '/my_path/directory_to_affect/foo.html' {
     # my settings are in here  


$HTTP["url"] =~ '/my_path/directory_to_affect/*' {
     # my settings are in here  

If I test my config file with lighttpd -D -f lighttpd.conf or try to restart lighttpd, I get this error:

2015-04-29 14:37:52: (configfile.c.892) source: /etc/lighttpd/lighttpd.conf line: 48 pos: 12 invalid character in variable name 
2015-04-29 14:37:52: (configfile.c.948) configfile parser failed at: ==

Or the same error but saying =~ instead of ==.

What's confusing me is that there are already other conditional configurations, e.g. where $SERVER["socket"] == ":80", and those configurations work just fine.


According to the lighttpd docs on configuration file syntax, only double quotes ", not ' are supported.

Your observation, that $SERVER["socket"] == ":80" works, but $HTTP["url"] == '/my_path/' isn't, confirms this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.