rclone:如何通过 HTTP 提供 S3 或 MinIO bucket 服务
注意:生产环境建议使用 nginx-s3-gateway 而非 rclone。详见使用 Traefik 反向代理 + nginx-s3-gateway 的 MinIO/S3 静态托管。
rclone 是一个强大的命令行工具,用于管理云存储上的文件。它可以通过 HTTP 提供 S3 或 MinIO bucket 服务。
以下命令提供目录列表,但不会自动将 index.html 作为目录索引。通过 HTTP 暴露 bucket 时请注意安全影响!
默认情况下,它们在 http://*:8080 上提供服务。
通过 HTTP 提供 MinIO 服务
rclone_serve_minio.sh
#!/bin/bash
# 使用 Minio 端点作为 S3 provider
AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=oXeidoo3voS0laghai1Oos5xoo8She \
rclone serve http ":s3,provider=Minio,env_auth=true,endpoint=minio.mydomain.com:my-bucket-name" \
--addr :8080 --read-only --no-modtime --vfs-cache-mode off --dir-cache-time 1m通过 HTTP 提供 S3 服务
rclone_serve_s3.sh
#!/bin/bash
# 使用 S3 端点作为 S3 provider
AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=oXeidoo3voS0laghai1Oos5xoo8She \
rclone serve http ":s3,provider=AWS,env_auth=true,region=$AWS_REGION:my-bucket-name" \
--addr :8080 --read-only --no-modtime --vfs-cache-mode off --dir-cache-time 1mCheck out similar posts by category:
S3
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow