这篇文章主要介绍“怎么使用docker compose安装FastDfs文件服务器”,在日常操作中,相信很多人在怎么使用docker compose安装FastDfs文件服务器问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么使用docker compose安装FastDfs文件服务器”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
version: '2' services: fastdfs-tracker: hostname: fastdfs-tracker container_name: fastdfs-tracker image: season/fastdfs:1.2 network_mode: "host" command: tracker volumes: - ./tracker_data:/fastdfs/tracker/data fastdfs-storage: hostname: fastdfs-storage container_name: fastdfs-storage image: season/fastdfs:1.2 network_mode: "host" volumes: - ./storage_data:/fastdfs/storage/data - ./store_path:/fastdfs/store_path environment: - TRACKER_SERVER=xxx.xxx.xxx.xxx:22122 command: storage depends_on: - fastdfs-tracker fastdfs-nginx: hostname: fastdfs-nginx container_name: fastdfs-nginx image: season/fastdfs:1.2 network_mode: "host" volumes: - ./nginx.conf:/etc/nginx/conf/nginx.conf - ./store_path:/fastdfs/store_path environment: - TRACKER_SERVER=xxx.xxx.xxx.xxx:22122 command: nginx
需要注意:
network_mode 必须是host, 原因是当上传文件时,tracker会把storage的IP和端口发给client,如果是bridge模式,则发送的是内网IP,client无法访问到。
image采用season/fastdfs:1.2 不要用lastest, 因为lastest不包含nginx服务,其他fasdfs镜像均没有season的精简。
listen 7003是ngingx服务访问端口,可自行切换
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 7003; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /group1/M00 { root /fastdfs/storage/data; ngx_fastdfs_module; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
到此,关于“怎么使用docker compose安装FastDfs文件服务器”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。