FastDFS安装配置以及整合Nginx测试
-
sudo apt-get install glibc-doc sudo apt-get install manpages-posix-dev
fastdfs依赖libfastcommon,需要从github上clone到本地编译安装。因此首先需要安装Git。
执行命令:
- apt-get install git
3:克隆libfastcommon库
- git clone https://github.com/happyfish100/libfastcommon.git
进入libfastcommon目录,依次执行脚本:
和5:设置环境变量和软链接
在32位ubuntu中,libfastcommon会安装在/usr/lib 中,64位系统则安装在 /usr/lib64 中。依次执行以下命令:(根据自己的操作系统选择路径)
和1:安装Tracker服务。
1、解压缩
2、./make.sh
3、./make.shinstall
安装后在/usr/bin/目录下有以fdfs开头的文件都是编译出来的。
配置文件都放到/etc/fdfs文件夹
4、把/root/FastDFS/conf目录下的所有的配置文件都复制到/etc/fdfs下。
5、配置tracker服务。修改/root/FastDFS/conf/tracker.conf文件。
6、启动tracker。/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
重启使用命令:/usr/bin/fdfs_trackerd/etc/fdfs/tracker.confrestart
2:安装storage服务。
1、如果是在不同的服务器安装,第四步的1~4需要重新执行。
2、配置storage服务。修改/root/FastDFS/conf/storage.conf文件
3、启动storage服务。
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
3:测试服务。
1、修改配置文件/etc/fdfs/client.conf
2、测试
/usr/bin/fdfs_test/etc/fdfs/client.conf upload anti-steal.jpg
4:搭建nginx提供http服务。
可以使用官方提供的nginx插件。要使用nginx插件需要重新编译。
fastdfs-nginx-module_v1.16.tar.gz
1、解压插件压缩包
2、修改/root/fastdfs-nginx-module/src/config文件,把其中的local去掉。
3、对nginx重新config
./configure--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf\
--pid-path=/usr/local/nginx/nginx.pid\
--with-http_ssl_module\
--add-module=/home/hc/upload/fastdfs-nginx-module/src
4、make 然后make install
5、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:
6、nginx的配置
在nginx的配置文件中添加一个Server:
- server {
listen 80;
server_name 192.168.101.3;
location /group1/M00/{
#root/home/FastDFS/fdfs_storage/data;
ngx_fastdfs_module;
}
}
7、将libfdfsclient.so拷贝至/usr/lib下
cp /usr/lib64/libfdfsclient.so /usr/lib/
8、启动nginx
上传测试成功