Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems adding mimetype.assign to lighttpd.conf

Tags:

lighttpd

I tried to add mimetype.assign = ( ".webapp" => "application/x-web-app-manifest+json" ) to my lighty conf file but got an error when restarting.

First the conf file:

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
#       "mod_rewrite",
)

server.document-root        = "/var/www/servers/www.nope.dyndns.org/pages/"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80

mimetype.assign   = ( ".webapp" => "application/x-web-app-manifest+json" )

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

...and the error:

sudo /etc/init.d/lighttpd restart
Duplicate config variable in conditional 0 global: mimetype.assign
2014-01-03 21:12:55: (configfile.c.943) source: /usr/share/lighttpd/create-mime.assign.pl line: 500 pos: 1 parser failed somehow near here: (EOL) 
2014-01-03 21:12:55: (configfile.c.943) source: /etc/lighttpd/lighttpd.conf line: 29 pos: 14 parser failed somehow near here: (EOL)

I took a guess and added the missing "application/x-web-app-manifest+json webapp" to the long list of mime-types in /etc/mime.types, but this didn't fix the problem.

Any ideas? Thanks.

like image 767
Leke Avatar asked Feb 15 '23 05:02

Leke


1 Answers

I hope You found out by now, but, for the sake of whoever is googling around...

Right syntax to add a value to an array is:

mimetype.assign   += ( ".webapp" => "application/x-web-app-manifest+json" )

Notice the "+="; that merges the new value(s) into the existing array.

like image 136
ZioByte Avatar answered Apr 26 '23 23:04

ZioByte