1.上传 fastdfs-5.11.zip fastdfs-nginx-module-master.zip libfastcommon-master.zip nginx-1.8.1.tar.gz
2.安装unzip,apt-get install unzip
3.解压文件 unzip *.zip
4.安装make,apt-get install make
5.安装gcc,apt-get install gcc
6.安装依赖
apt-get install build-essential
apt-get install libtool
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g-dev
apt-get install openssl
7.编译安装libfastcommon-master
cd libfastcommon-master
./make.sh
./make.sh install
8.编译安装fastdfs
cd fastdfs-5.11
./make
./make.sh install
9.配置fdfs
cd /etc/fdfs
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf
cp tracker.conf.sample tracker.conf
mkdir -p /data/fastdfs/storage
mkdir -p /data/fastdfs/client
mkdir -p /data/fastdfs/tracker
vi tracker.conf
base_path=/data/fastdfs/tracker
启动:fdfs_trackerd /etc/fdfs/tracker.conf start
检查:ps -aux|grep tracker
vi storage.conf
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
http.server_port=8888 --对应nginx端口
tracker_server=服务器ip<使用127.0.0.1会出现异常>:22122
启动:fdfs_storaged /etc/fdfs/storage.conf start
检查:ps -aux|grep storage
vi client.conf
base_path=/data/fastdfs/client
tracker_server=服务器ip<使用127.0.0.1会出现异常>:22122
测试上传:fdfs_test /etc/fdfs/client.conf upload 654c9250-0250-4dc7-b348-834d17dc4463.png
有图片信息返回则表示正常:example file url: xxx/group1/M00/00/00/wKh-g1z3mHyAGQzyAACQOzOVRzU863_big.png
10.安装配置nginx
mv nginx-1.8.1 /etc/nginx
mv fastdfs-nginx-module-master /etc/nginx
vi fastdfs-nginx-module-master/src/config
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
./configure --prefix=/usr/local/nginx --add-module=./fastdfs-nginx-module-master/src/
make
make install
cp xx/fastdfs-5.11/conf/http.conf xx/fastdfs-5.11/conf/mime.types /etc/fdfs
vi /usr/local/nginx/conf/nginx.conf
listen 8888;
location /group1/M00 {
root /data/fastdfs/storage/;
ngx_fastdfs_module;
}
启动nginx:/usr/local/nginx/sbin/nginx
重启:/usr/local/nginx/sbin/nginx -s reload
上传测试:fdfs_test /etc/fdfs/client.conf upload 654c9250-0250-4dc7-b348-834d17dc4463.png
浏览器访问:http://ip:端口/group1/M00/00/00/wKh-g1z3sHyAKGHVAACQOzOVRzU727_big.png