下载安装包地址:
libevent-2.1.8-stable.tar.gz:
http://libevent.org/
libfastcommonV1.07:
https://github.com/happyfish100/libfastcommon
fastdfs5.05:
https://github.com/happyfish100/fastdfs
astdfs-nginx-module_v1.16.tar_2.gz:
https://github.com/happyfish100/fastdfs-nginx-module
安装步骤
1. libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/usr
make
make install
1. libfastcommonV1.07.tar.gz
tar -zxvf libfastcommonV1.07.tar.gz
cd libfastcommonV1.07
./make.sh
./make.sh install
cp /usr/lib64/libfastcommon.so /usr/lib
1. fastdfs5.05--安装Tracker服务
tar -zxvf fastdfs5.05.tar.gz
cd fastdfs5.05
./make.sh
./make.sh install
#查看安装结果:
/usr/bin# ll fdfs_*
#把/root/FastDFS/conf目录下的所有的配置文件都复制到/etc/fdfs下
cd /root/fastdfs-5.05/conf
cp * /etc/fdfs
#配置tracker服务
cd /etc/fdfs
vi tracker.conf
#修改
base_path=/usr/local/fastdfs/tracker
#创建/usr/local/fastdfs/tracker路径
mkidr /usr/local/fastdfs
mkidr /usr/local/fastdfs/tracker
#启动tracker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
#重启使用命令
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
安装storage服务
#设置日志保存路径
base_path=/usr/local/fastdfs/storage
#设置图标文件的保存位置
store_path0=/usr/local/fastdfs/storage
#设置tracker服务
tracker_server=144.79.196.28:22122
#创建该路径
mkdir /usr/local/fastdfs/storage
#启动服务
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
测试
cd /etc/fdfs
vi client.conf
#设置日志路径
base_path=/usr/local/fastdfs/client
#设置链接服务
tracker_server=134.79.196.28:22122
#创建路径
mkdir /usr/local/fastdfs/client
#开始测试
cd /etc/fdfs
#上传当前anti-steal.jpg图片
/usr/bin/fdfs_test /etc/fdfs/client.conf upload anti-steal.jpg
#结果如下则成功:
file crc32=2553063749example file url: http://10.9.96.28/group1/M00/00/00/rBIHSVp4F2eAVzatAABdrZgsqUU155.jpg
remote_filename=M00/00/00/rBIHSVp4F2eAVzatAABdrZgsqUU155_big.jpg
example file url: http://10.7.16.28/group1/M00/00/00/rBIHSVp4F2eAVzatAABdrZgsqUU155_big.jpg
安装astdfs-nginx-module_v1.16.tar_2.gz
tar astdfs-nginx-module_v1.16.tar_2.gz
mv nginx-module /usr/local
cd usr/local/nginx-module/src
vi config
去掉local
image.png
对nginx重新config
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--add-module=/usr/local/fastdfs-nginx-module/src
make
make install
把/usr/local/fastdfs-nginx-module/src /mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:
image.png在nginx的配置文件中添加一个Server:
server {
listen 80;
server_name 192.168.101.3;
location /group1/M00/{
#root /home/FastDFS/fdfs_storage/data;
ngx_fastdfs_module;
}
}
将libfdfsclient.so拷贝至/usr/lib下
cp /usr/lib64/libfdfsclient.so /usr/lib/
启动nginx
浏览器运行:
http://xx.79.196.28/group1/M00/00/00/rBIHSVp5CQOAXq_AAABdrZgsqUU861.jpg
该url是在上面测试阶段产生的
image.png
网友评论