靜態站點
直接從磁碟提供 HTML、CSS、圖片和下載檔案。這是最簡單的 Fluxheim 模式。
何時使用
靜態託管適合文件、產品頁面、下載和不需要每個 request 都執行應用程式碼的站點。
- ETag 和 conditional request 可減少重複流量。
- Byte ranges 可用於較大的檔案。
- 公共 root 應繼續拒絕 dotfile。
靜態站點示例
[[vhosts]]
name = "docs"
hosts = ["docs.example.com"]
[vhosts.web]
root = "/srv/docs"
index_files = ["index.html"]
deny_dotfiles = true
主要選項
| 選項 | 在以下情況使用 |
|---|---|
root | 你希望公共檔案使用有界 filesystem root。 |
index_files | 目錄應解析為 index file。 |
deny_dotfiles | 隱藏檔案絕不能意外公開。 |
directory_listing | 你有意發布 repository-style file indexes。 |
Repository 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.