Auto-sync: 2026-04-18 16:02

This commit is contained in:
2026-04-18 16:02:38 +08:00
parent badd1215d7
commit e7e77ae92e
55 changed files with 3026 additions and 16 deletions

View File

@@ -0,0 +1,55 @@
---
title: "静态站点托管"
type: concept
tags: []
---
## 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
```nginx
try_files $uri $uri.html $uri/ =404;
```
### Apache
需要启用 mod_rewrite 模块处理 .html 扩展名:
```apache
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ $1.html [L]
```
### Caddy
Caddyfile 配置:
```caddy
example.com {
root * /path/to/quartz/public
try_files {path} {path}.html {path}/ =404
file_server
}
```
## Related Concepts
- [[静态站点生成]]
- [[HTTPS]]
- [[域名]]
- [[Let's Encrypt]]