You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Lighttpd配置语法错误排查求助

Lighttpd配置语法错误排查求助

我是lighttpd的纯新手,折腾自定义默认配置快被逼疯了,实在搞不懂哪里出问题了。先贴一下我当前的配置:

debug.log-request-handling = "enable"

server.port = 80

server.modules = (
    "mod_indexfile",
    "mod_access",
    "mod_alias",
    "mod_redirect",
    "mod_dirlisting",
    "mod_staticfile",
    "mod_access",
    "mod_alias",
    "mod_accesslog",
    "mod_compress",
    "mod_expire",
    "mod_redirect",
    "mod_rewrite",
)

server.document-root        = "/var/www/html"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads")
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.bind = "10.0.3.15"

# features
server.feature-flags       += ("server.h2proto" => "enable")
server.feature-flags       += ("server.h2c"     => "enable")
server.feature-flags       += ("server.graceful-shutdown-timeout" => 5)
#server.feature-flags       += ("server.graceful-restart-bg" => "enable")

# strict parsing and normalization of URL for consistency and security
# (might need to explicitly set "url-path-2f-decode" = "disable"
#  if a specific application is encoding URLs inside url-path)
server.http-parseopts = (
    "header-strict"           => "enable",# default
    "host-strict"             => "enable",# default
    "host-normalize"          => "enable",# default
    "url-normalize-unreserved"=> "enable",# recommended highly
    "url-normalize-required"  => "enable",# recommended
    "url-ctrls-reject"        => "enable",# recommended
    "url-path-2f-decode"      => "enable",# recommended highly (unless breaks app)
    #"url-path-2f-reject"      => "enable",
    "url-path-dotseg-remove"  => "enable",# recommended highly (unless breaks app)
    #"url-path-dotseg-reject"  => "enable",
    #"url-query-20-plus"       => "enable",# consistency in query string
)

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

# 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.conf.pl"
include "/etc/lighttpd/conf-enabled/*.conf"

#server.compat-module-load   = "disable"

然后我遇到的错误日志是这样的:

2024-02-07 19:23:14: (configfile.c.2109) source: /etc/init.d/lighttpd line: 15 pos: 5 invalid character in variable name
2024-02-07 19:23:14: (configfile.c.2161) configfile parser failed at: =

我完全搞不懂为什么会提示第15行有错误……

不过等等,我好像反应过来了——应该是我测试命令打错字了,误让它检查了一个本来就不该用lighttpd配置语法解析的文件,难怪会报错。

备注:内容来源于stack exchange,提问作者Calvin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 06:58:07