靜態網站
直接由磁碟提供 HTML、CSS、圖片同下載檔。呢個係 Fluxheim 最簡單嘅模式。
幾時使用
文件、product pages、下載同每次 request 都唔需要 application code 嘅網站,適合用 static hosting。
- ETag 同 conditional request 可以減少重複流量。
- 位元組範圍適用於較大的檔案。
- public roots 入面應該繼續拒絕 dotfiles。
static site 例子
[[vhosts]]
name = "docs"
hosts = ["docs.example.com"]
[vhosts.web]
root = "/srv/docs"
index_files = ["index.html"]
deny_dotfiles = true
主要選項
| 選項 | 以下情況使用 |
|---|---|
root | 公開檔案需要一個受限制嘅 filesystem root。 |
index_files | 目錄應解析為索引檔。 |
deny_dotfiles | Hidden files must never become 公開 by accident. |
directory_listing | 您有意發布儲存庫樣式的文件索引。 |
儲存庫清單範例
[[vhosts.routes]]
name = "repo"
path_prefix = "/repo/"
[vhosts.routes.web]
root = "/srv/repository/public"
index_files = ["index.html"]
[vhosts.routes.web.directory_listing]
enabled = true
exact_size = false
Directory listings stay private-cache by default, skip symlink entries, and still prefer index files when they exist.