https://github.com/seaweedfs/seaweedfs/wiki/Client-Libraries

docker-compose.yml

version: '3'

services:
  seaweedfs:
    container_name: sys_seaweedfs
    image: chrislusf/seaweedfs
    restart: always
    networks:
      - mynetwork
#    ports:
#      - "3002:9333"
#      - "3003:8080"
    volumes:
      - ./data:/data
    command: server
      - "-dir=/data"
      - "-filer=true"
networks:
  mynetwork:
    external: true

fs.wdzs.cn.conf

server {
  server_name     oss.wdzs.cn;
  sendfile        on;
  keepalive_timeout  65;
  client_max_body_size 100m;
  include         /common/all_api.inc;
  location / {
    root    /;   
#    proxy_pass   http://192.168.100.1:3003/;
    proxy_pass   http://seaweedfs:8080/;

    limit_except GET {
        deny all;
    }
  }
  location /upload/ {
    root    /;
#    proxy_pass   http://192.168.100.1:3002/;
    proxy_pass   http://seaweedfs:9333/;

    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Proxy "";
    proxy_buffering on;     # GET buffering or “X-Accel-Buffering” enables or disables buffering of a response;
    proxy_buffers 64 1m;  # buffers used for reading a response from the proxied server, for a single connection
    proxy_buffer_size 8k; # maximum size of the data that nginx can receive from the server at a time is set
    proxy_busy_buffers_size 2m;

    proxy_request_buffering on;  # PUT buffering
    proxy_next_upstream error timeout non_idempotent http_500; # PUT request should be passed to the next server:
    proxy_connect_timeout 200ms;
    proxy_read_timeout    3s; #timeout is set only between two successive read operations
    proxy_send_timeout    3s; #timeout is set only between two successive write operations
  }
}

文件上传

curl -F "file=@711561.jpg" http://oss.wdzs.cn/upload/submit

文件删除

curl -X DELETE http://oss.wdzs.cn/4/0947f807b5/711561.jpg

文件访问

http://oss.wdzs.cn/4/0947f807b5/711561.jpg?width=800

标签: none

评论已关闭