在Lighttpd中配置子域

时间:2016-11-20 16:13:15

标签: lighttpd vhosts subdomain

如果我尝试添加子域名,我就无法启动lighttpd。一旦我尝试使用以下行加载配置文件,就会发生一些错误而没有进一步的细节:

$HTTP["host"] == "sub.localhost" {
  server.document-root = "/var/www
}

子域没有自己的文件夹。所以使用mod_simple_vhost不会起作用。

错误消息:

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since So 2016-11-20 16:59:43 CET; 3s ago
  Process: 7568 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
  Process: 26067 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
 Main PID: 7568 (code=exited, status=0/SUCCESS)

Nov 20 16:59:43 mantra systemd[1]: Starting Lighttpd Daemon...
Nov 20 16:59:43 mantra lighttpd[26067]: 2016-11-20 16:59:43: (configfile.c.898) source: /etc/lighttpd/lighttpd.conf lin
Nov 20 16:59:43 mantra lighttpd[26067]: 2016-11-20 16:59:43: (configfile.c.954) configfile parser failed at: ] ==
Nov 20 16:59:43 mantra systemd[1]: lighttpd.service: Control process exited, code=exited status=255
Nov 20 16:59:43 mantra systemd[1]: Failed to start Lighttpd Daemon.
Nov 20 16:59:43 mantra systemd[1]: lighttpd.service: Unit entered failed state.
Nov 20 16:59:43 mantra systemd[1]: lighttpd.service: Failed with result 'exit-code'.

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您发布的示例缺少该行末尾的结束双引号 server.document-root = "/var/www"

这可能是您帖子中的拼写错误,但无论如何,来自lighttpd的错误消息会向您报告您遇到错误的lighttpd.conf中的行号。请查看lighttpd.conf中的该行,并确保语法正确。

参考:https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Configuration