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
#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails
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
# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails
# (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 行出现错误

没关系,我相信我在测试命令中输入了一个错误,并让它检查一些显然是错误的东西

答案1

大多数初学者都会犯非常明显的错误判断因为他们太快法官而不是观察

接下来两行有什么区别?
/etc/init.d/lighttpd
/etc/lighttpd/lighttpd.conf

它们看起来完全一样吗,或者有什么不同吗?

/etc/init.d/lighttpd 是用于管理 lighttpd 守护进程的初始化脚本。

/etc/lighttpd/lighttpd.conf 是一个配置文件。

您发布的错误消息 2024-02-07 19:23:14: (configfile.c.2109) source: /etc/init.d/lighttpd line: ...表明您用来检查 lighttpd 语法的测试命令是错误的。

错误:lighttpd -f /etc/init.d/lighttpd -tt没有任何意义。

正确:lighttpd -f /etc/lighttpd/lighttpd.conf -tt检查 /etc/lighttpd/lighttpd.conf 配置文件的 lighttpd 配置语法。

没关系,我相信我在测试命令中输入了一个错误,并让它检查一些显然是错误的东西

观察stackoverflow 不是电子邮件线程,您应该更新帖子以突出显示您发现的问题,然后关闭帖子以解决问题。

观察当您在错误日志中发布错误时,您并没有发布您使用的命令,结果发现错误出在您使用的命令中,而当您问“我做错了什么?”时,您没有在这篇文章中分享这一点。

相关内容