前提,你有一台服务器,一个Google drive 2T白嫖账号。在服务器上搭建了rclone服务,并且挂载了google drive
一、设置rclone系统服务
sudo nano /etc/systemd/system/rclone-s3.service
[Unit]
Description=Rclone S3 Service for Google Drive
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/rclone serve s3 \
  --addr 0.0.0.0:10000 \
    --auth-key yourAccess key ID,yourSecret Key \
  --etag-hash md5 \
  --force-path-style=false \
  googledrive:
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
主要变量含义
- 
Type=simple: 服务类型为简单类型,进程在前台运行 
- 
User=root: 以 root 用户身份运行服务 
- 
ExecStart: 服务启动时执行的命令,包含以下 Rclone 参数: - /usr/bin/rclone serve s3 googledrive:s3: 使用 Rclone 将 Google Drive 作为 S3 服务提供
- googledrive: 这是在 Rclone 配置文件中定义的远程存储配置名称,s3是 Google Drive 中的一个文件夹路径
- --addr 0.0.0.0:10000: 监听所有网络接口的 10000 端口
- --auth-key: S3 认证密钥对(Access Key 和 Secret Key)
- --etag-hash md5: 使用 MD5 作为 ETag 哈希算法
 
- 
Restart=on-failure: 服务失败时自动重启 
- 
RestartSec=10: 重启前等待 10 秒 
保存,启动服务,查看服务状态
sudo systemctl daemon-reload
sudo systemctl restart rclone-s3
sudo systemctl status rclone-s3
二、优化反向代理设置
你要设置DNS服务器(cf),1panel反向代理,
s3.888888.xyz
和
*.s3.888888.xyz
全部指向你的服务器IP,并且申请函盖着两个域名的证书,
以1panel为例
修改 /opt/1panel/apps/openresty/openresty/www/sites/s3.888888.xyz/proxy/root.conf
location / {
    # 直接反代到 rclone S3 网关
    proxy_pass http://localhost:10000;
    proxy_http_version 1.1;
    # 保留原始 Host 头,保证 S3 签名一致
    proxy_set_header Host              $host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    # 上传大文件直传
    proxy_request_buffering off;
    proxy_buffering         off;
    client_max_body_size    500M;
}
二、S3存储桶主要参数
第一步设置存储桶,已经顺利完成。但是仅支持路径式的地址存储桶!
主要参数:
- 
Access key ID:配置文件中第一个yourAccess key ID 
- 
Secret Key:配置文件中第二个yourSecret Key 
- 
Region:随便,比如us-east-1 
- 
Endpoint:你的反向代理的指向你的服务器的域名比如 https://s3.888888.xyz 
- 
Bucket:你设置的谷歌网盘下面的文件夹,每一个文件夹就是一个存储桶 
 ,新建存储桶就直接新建文件夹就行
每次新建存储桶之后,在本地运行一下这个命令: sudo systemctl restart rclone-s3