Fluxheim/文档/静态站点

静态站点

直接从磁盘提供 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.

简体中文