# 搭建Docker Fastdfs服务 **Repository Path**: ryanzl/fastdfs_docker ## Basic Information - **Project Name**: 搭建Docker Fastdfs服务 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-05-09 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 搭建Docker Fastdfs服务 ## docker使用fastdfs 此容器包括 tracker storage nginx docker pull zhangxuedong/fdfs_sam ## 在宿主机创建文件夹  /FILE_SERVER/fdfs_docker/fastdfs_storage_data /FILE_SERVER/fdfs_docker/fastdfs_storage_info /FILE_SERVER/fdfs_docker/fastdfs_tracker /FILE_SERVER/fdfs_docker/conf ## 执行脚本:start_com.sh ps:脚本启动相关服务 fdfs_trackerd /etc/fdfs/tracker.conf fdfs_storaged /etc/fdfs/storage.conf /usr/local/nginx/sbin/nginx -c /etc/fdfs/nginx.conf ## 注:出错请查看日志: cat /mnt/fastdfs_tracker/logs/tracker.log cat /mnt/fastdfs_storage_info/logs/storage.log ## 测试 docker exec -it fdfs_com2 bash vi /home/test.txt fdfs_test /etc/fdfs/client.conf upload /home/test.txt 宿主机浏览器访问:http://localhost:8888/group1/M00/00/00/rBEAA1rywWyAccQlAAAAA9eyFNo345_big.txt ## nginx配置 简洁版 nginx 配置样例: ``` user root; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8888; server_name localhost; location ~/group([0-9])/M00 { #alias /fastdfs/storage/data; ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } ``` A、8888 端口值是要与/etc/fdfs/storage.conf 中的 http.server_port=8888 相对应, 因为 http.server_port 默认为 8888,如果想改成 80,则要对应修改过来。 B、Storage 对应有多个 group 的情况下,访问路径带 group 名,如/group1/M00/00/00/xxx, 对应的 Nginx 配置为: ``` location ~/group([0-9])/M00 { ngx_fastdfs_module; } ``` 参考: https://www.cnblogs.com/zhangxd0112/p/7905638.html https://blog.csdn.net/zxl315/article/details/53537628