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

  发布于 2023-02-06 17:38

我尝试将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类型列表中,但这并没有解决问题.

有任何想法吗?谢谢.

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

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

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

    注意"+ ="; 将新值合并到现有数组中.

    2023-02-06 17:40 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有