Files
nexus/wiki/concepts/图床.md
2026-04-22 08:02:59 +08:00

76 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 图床
type: concept
tags: [image, hosting, web]
date: 2025-12-29
---
# 图床
## Definition
图床Image Hosting是指托管图片/媒体文件的服务,通过 URL 直接访问托管的文件。传统图床(如 Imgur、SM.MS是第三方云服务自托管图床则在自有服务器上运行提供完全的数据控制。
## Alternatives Comparison
| 图床方案 | 存储位置 | 成本 | 控制权 | 适用场景 |
|----------|----------|------|--------|----------|
| Imgur | 云端 | 免费有限 | 无 | 临时分享 |
| SM.MS | 云端 | 免费 | 无 | 临时分享 |
| Cloudflare R2 | 云端S3兼容 | 按量计费 | 部分 | 生产环境 |
| **MinIO + Zipline** | 本地 NAS | 仅电费 | 完全 | 自托管 |
| Chevereto | 自托管 | 仅服务器 | 完全 | 自托管 |
## Architecture Patterns
### Pattern 1: MinIO + Zipline本方案
```
[Zipline UI/API] → [S3 API] → [MinIO] → [NAS Storage]
[PostgreSQL]
(metadata)
```
### Pattern 2: Direct Upload to S3
```
[Client] → [Presigned URL] → [AWS S3/R2/MinIO]
```
### Pattern 3: Traditional Self-Hosted
```
[Nginx] → [Local Filesystem] → [Disk/NAS]
```
## Key Design Considerations
1. **存储后端选择**
- S3 兼容(如 MinIO可迁移性强与云端互通
- 本地文件系统:简单但迁移困难
2. **访问控制**
- Public Bucket图片直接访问无需认证
- Presigned URL限时访问适合私有内容
3. **元数据管理**
- 数据库存储:支持搜索、统计、管理
- 文件系统存储:简单但功能有限
4. **工作流集成**
- API 上传:[[n8n]]、脚本自动化
- 前端直传:用户体验好但需 CORS 配置
## MinIO + Zipline Specifics
- **MinIO**S3 兼容对象存储,存储文件实体
- **Zipline**:图床应用层,提供 UI + API
- **PostgreSQL**元数据存储文件名、URL、时间戳等
## Connections
- [[Zipline]] ← provides ← [[图床]]
- [[MinIO]] ← stores ← [[图床]] files
- [[n8n]] ← integrates with ← [[图床]]
## Related Concepts
- [[S3-兼容对象存储]]
- [[对象存储]]
- [[Docker堆栈]]