将mimetype.assign添加到lighttpd.conf时出现问题

时间:2014-01-03 19:26:34

标签: lighttpd

我尝试将mimetype.assign =(“。webapp”=>“application / x-web-app-manifest + json”)添加到我的轻薄conf文件中,但重新启动时出错。

首先是conf文件:

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"

......和错误:

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)

我猜了一下,并将缺少的“application / x-web-app-manifest + json webapp”添加到/etc/mime.types中的mime-types的长列表中,但是这并没有解决问题。

有什么想法吗?谢谢。

1 个答案:

答案 0 :(得分:5)

我希望你现在发现了,但是,为了那个用Google搜索的人......

向数组添加值的正确语法是:

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

注意" + =&#34 ;;将新值合并到现有数组中。