1.1 KiB
1.1 KiB
title, type, tags
| title | type | tags |
|---|---|---|
| 静态站点托管 | concept |
Definition
静态站点托管(Static Site Hosting)指将静态 HTML、CSS、JavaScript 文件部署到 Web 服务器上对外提供服务。Quartz 支持 Nginx、Apache、Caddy 三种自托管方案。
Hosting Solutions
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
}