在 Lighttpd 中配置子域 (Configure subdomains in Lighttpd)


問題描述

在 Lighttpd 中配置子域 (Configure subdomains in Lighttpd)

如果我嘗試添加子域,我將無法啟動 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:

The example you posted is missing a closing double‑quote at the end of the line server.document‑root = "/var/www"

That might be a typo in your post, but in any case, the error message from lighttpd reports to you the line number in your lighttpd.conf on which you had an error. Please look at that line in your lighttpd.conf and make sure the syntax is correct.

Reference: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Configuration

(by user2429266gstrauss)

參考文件

  1. Configure subdomains in Lighttpd (CC BY‑SA 2.5/3.0/4.0)

#lighttpd #vhosts #subdomain






相關問題

Lighttpd 單個子域重定向/重寫 (Lighttpd single subdomain Redirect/rewrite)

在 lighttpd 中包含許多重寫指令 (Including many rewrite directives in lighttpd)

lighttpd:禁用 CGI 緩衝 (lighttpd: disable CGI buffering)

lighttpd:身份驗證後如何將端口(僅對本地主機可見)轉發到 WAN? (lighttpd: How to forward port (visible only to localhost) to WAN after authentication?)

在centos 404錯誤中安裝Lighttpd (install of Lighttpd in centos 404 error)

在 Lighttpd 中配置子域 (Configure subdomains in Lighttpd)

如何根據用戶登錄重定向 Lighttpd webdav 掛載 (How can I redirect a Lighttpd webdav mount depending on user login)

如何在 Windows 2003 上使用 mongrel、lighttpd 和 iis 設置負載平衡的 Rails Web 服務器 (how do i set up a load balanced Rails web server using mongrel, lighttpd and iis on windows 2003)

Lighttpd:視頻無法正常流式傳輸 (Lighttpd: Videos not streaming properly)

Apache、lighttpd、nginx、切諾基,什麼是最好的組合? (Apache, lighttpd, nginx, cherokee, what's the best combination?)

web.py + lighttpd + matplotlib 不工作 (web.py + lighttpd + matplotlib not working)

在 lighttpd 中重寫後得到錯誤的 PATH_INFO (Get wrong PATH_INFO after rewriting in lighttpd)







留言討論