Fluxheim/Tài liệu/Trang static

Trang static

Phục vụ HTML, CSS, hình ảnh và tệp tải xuống trực tiếp từ đĩa. Đây là chế độ đơn giản nhất của Fluxheim.

Khi nào dùng

Dùng static hosting cho tài liệu, product pages, downloads và các site không cần application code ở mỗi request.

  • ETag và conditional request giúp giảm lưu lượng lặp lại.
  • Phạm vi byte hoạt động cho các tệp lớn hơn.
  • Dotfiles nên tiếp tục bị chặn trong public roots.

ví dụ static site

[[vhosts]]
name = "docs"
hosts = ["docs.example.com"]

[vhosts.web]
root = "/srv/docs"
index_files = ["index.html"]
deny_dotfiles = true

tùy chọn chính

Tùy chọnDùng khi
rootCần một filesystem root có giới hạn cho các file công khai.
index_filesMột thư mục sẽ phân giải thành một tệp chỉ mục.
deny_dotfilesHidden files must never become công khai by accident.
directory_listingBạn cố tình xuất bản các chỉ mục tệp kiểu kho lưu trữ.

Ví dụ về danh sách kho lưu trữ

[[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.

Tiếng Việt