Files
nexus/wiki/concepts/静态站点托管.md
2026-04-18 16:02:38 +08:00

1.1 KiB
Raw Blame History

title, type, tags
title type tags
静态站点托管 concept

Definition

静态站点托管Static Site Hosting指将静态 HTML、CSS、JavaScript 文件部署到 Web 服务器上对外提供服务。Quartz 支持 Nginx、Apache、Caddy 三种自托管方案。

Hosting Solutions

  • Nginx — 高性能反向代理和静态文件服务
  • Apache — 通过 .htaccess 进行 URL 重写配置
  • Caddy — 自动 HTTPSCaddyfile 简明配置

Configuration

Nginx

需要配置 try_files 规则处理无扩展名 URL

try_files $uri $uri.html $uri/ =404;

Apache

需要启用 mod_rewrite 模块处理 .html 扩展名:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ $1.html [L]

Caddy

Caddyfile 配置:

example.com {
    root * /path/to/quartz/public
    try_files {path} {path}.html {path}/ =404
    file_server
}