安装软件
# libfastcommon
wget https://github.com/happyfish100/libfastcommon/archive/refs/tags/V1.0.66.zip
unzip V1.0.66.zip
./make.sh && ./make.sh install
# libserverframe
wget https://github.com/happyfish100/libserverframe/archive/refs/tags/V1.1.25.zip
unzip V1.1.25.zip
./make.sh && ./make.sh install
# FastDFS
wget https://github.com/happyfish100/fastdfs/archive/refs/tags/V6.9.4.zip
unzip V6.9.4.zip
./make.sh && ./make.sh install
# Nginx
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/refs/tags/V1.23.zip
wget https://nginx.org/download/nginx-1.24.0.tar.gz
unzip V1.23.zip
tar -zxvf nginx-1.24.0.zip
# debian
apt install -y libpcre3 libpcre3-dev zlib1g-dev openssl libssl-dev
# centos
yum install -y zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc
./configure --add-module=../fastdfs-nginx-module-1.23/src/
make && make install
/usr/local/nginx/sbin/nginx -V
配置文件
# tracker: 配置 base_path 和 http.server_port
vi /etc/fdfs/tracker.conf
# 配置 PIDFile: 路径为 tracker.conf 里的 base_path
vi /usr/lib/systemd/system/fdfs_trackerd.service
# storage: 配置 base_path, tracker_server, http.server.port=80 并且注释掉 store_path0
vi /etc/fdfs/storage.conf
# 配置 PIDFile: 路径为 storage.conf 里的 base_path
vi /usr/lib/systemd/system/fdfs_storaged.service
# client: 配置 base_path, tracker_server, http.tracker_server_port
vi /etc/fdfs/client.conf
# nginx
cd /opt/fastdfs-6.9.4/conf
cp anti-steal.jpg http.conf mime.types /etc/fdfs
cp /opt/fastdfs-nginx-module-1.23/src/mod_fastdfs.conf /etc/fdfs/
# 配置 connect_timeout=10, tracker_server, url_have_group_name=true 并且注释掉 store_path0
vi /etc/fdfs/mod_fastdfs.conf
# listen port 与 /etc/fdfs/storage.conf http.server.port 保持一致
# 添加:
# location /group0/M00/00/00 {
# alias /home/yuqing/fastdfs/storage/data;
# ngx_fastdfs_module;
# }
vi /usr/local/nginx/conf/nginx.conf
启动
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start (systemctl start fdfs_trackerd)
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start (systemctl start fdfs_storaged)
netstat -unltp | grep fdfs
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
/usr/local/nginx/sbin/nginx
测试
# 使用web访问返回的文件名
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /path/to/file
TODO: nginx 调试未成功, 实在不行就用docker部署了