一. 安装fastdfs.
1. git下载zip包, 解压进入
https://github.com/happyfish100/libfastcommon
https://github.com/happyfish100/fastdfs
2. 安装依赖包libfastcommon, 和fastdfs包, 安装方法相同.
cd 进文件夹
./make.sh sudo ./make.sh install
3.修改配置参数
安装完之后, 直接cd 进入/etc/fdfs/
cp 作者提供的设置样本,
sudo cp ./tracker.conf.sample ./tracker.conf sudo cp ./storage.conf.sample ./storage.conf sudo cp ./client.conf.sample ./client.conf
修改相应参数
修改tracker的文件位置,例如:/home/fastdfs/tracker ,bind_address不设置时,绑定本机地址
sudo vim ./tracker.conf
base_path=/home/fastdfs/tracker
修改storage的文件位置及上面tracker服务所在的外网地址, 例如192.168.0.1:22122
sudo vim ./storage.conf
base_path=/home/fastdfa/storage
tracker_server=192.168.0.1:22122
修改client文件位置,对应的tracker地址
base_path=/home/python/fastdfs/tracker
tracker_server=192.168.0.1:22122
4. 启动服务
sudo /usr/bin/fdfs_tracked /etc/fdfs/tracker.conf sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
5. 查询并上传文件以测试服务
ps aux|grep fdfs fdfs_upload_file /etc/fdfs/client.conf
有返回文件id则服务正常
"group1/M00/00/00/wKgBA12En06AU7VbAAHew_W99e0827.jpg"
二. 安装nginx(依赖PCRE,zlib,OpenSSL库)
1. 下载nginx包, 以及nginx的fastdfs扩展包.
http://nginx.org/en/download.html
https://github.com/happyfish100/fastdfs-nginx-module
2. 增加nginx安装前缀, 添加fastdfs支持
cd 进nginx解压包
前置命令格式
sudo ./configure --prefix=[nginx所要安装的绝对路径] --add-module=[指向 增加的扩展包的绝对路径内的src源代码文件夹]
例:
sudo ./configure --prefix=/usr/local/nginx/ --add-module=/home/jrri/Downloads/fastdfs-nginx-module-master/src
sudo make sudo make install