fastdfs_nginx整合
环境:fastDFS_5.04 nginx_1.4.7,CentOS 6 64位
1.在此之前你应该安装成功了fastDFS了
2.安装nginx
3.下载 FastDFS-nginx模块
官方下载:下载地址
解压文件:
tar xzf fastdfs_nginx_module_v1.05.tar.gz
4.进入nginx文件夹。编译
./configure --add-module=/home/fastdfs-nginx-module/src make; make install;
5.配置/home/fastdfs-nginx-module/src/mod_fastdfs.conf
#192.168.1.239是我自己电脑的tracker_server地址 tracker_server=192.168.1.239:22122
#如果访问路径中有group1,设置url_have_group_name为true,默认为false
url_have_group_name=true
#设置storage的路径,可以设置多个,如果多个需要设置store_path_count=数量
store_path0=/home/leunpha/storage/data
6.复制/home/fastdfs-nginx-module/src/mod_fastdfs.conf 到/etc/fdfs/目录下
cp /home/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
7.配置nginx.conf
配置${nginx_home}/conf/nginx.conf,在server中添加
#group1这儿可以配置成正则
location /group1/M00 { #root /home/leunpha/storage/data; ngx_fastdfs_module; }
8.添加软连接
# ln -s /home/leunpha/storage/data /home/leunpha/storage/data/M00
9.启动nginx
#启动 /usr/local/nginx/sbin/nginx
##其他命令 #关闭 /usr/local/nginx/sbin/nginx -s stop #重新加载 /usr/local/nginx/sbin/nginx -s reload
然后访问http://192.168.1.239/group1/M00/00/00/wKgB71u7sZCAYPwoAAzUD9gIb9c.tar.gz应该就可以了。