分布式文件系统FastDFS+nginx配置详解
来源:互联网 发布:php微信扫码支付源码 编辑:程序博客网 时间:2024/05/16 17:29
这几天在玩FastDFS,在惊叹余大之牛的同时也由衷地感谢鱼大的共享。针对Nginx+FastDFS的配置,做了些简单记录,希望能对后面了解这方面的朋友有所帮助。也希望余大及其他对这块有研究的朋友多多指正。
具体步骤如下:
1、安装FastDFS(我装的是最新的版本FastDFS_v4.06),具体安装步骤这里就不重复了。
2、安装Nginx(我装的版本是:nginx-1.4.2),可直接以root用户按默认安装,我是非root用户指定目录编译安装:
1)下载nginx安装包及依赖包(nginx-1.4.2.tar.gz、pcre-8.33.tar.gz、zlib-1.2.8.tar.gz)
2)分别解压:
# tar zxvf nginx-1.4.2.tar.gz
# tar zxvf pcre-8.33.tar.gz
# tar zxvf zlib-1.2.8.tar.gz
3)编译安装
# cd nginx-1.4.2
#./configure --prefix=/webapp/nginx --with-pcre=/webapp/tools/pcre-8.33 --with-zlib=/webapp/tools/zlib-1.2.8
# make
# make install
4)修改nginx.conf配置文件,启动nginx验证是否安装成功
3、Nginx添加模块
1)下载安装包(我用的是fastdfs-nginx-module_v1.15)
2)解压:tar xzf fastdfs-nginx-module_v1.15.tar.gz
3)编译安装(Nginx的安装源目录,即nginx-1.4.2解压目录):
# ./configure --prefix=/webapp/nginx --add-module=/webapp/tools/fastdfs-nginx-module/src --with-pcre=/webapp/tools/pcre-8.33 --with-zlib=/webapp/tools/zlib-1.2.8
# make
# make install
说明:如果需要修改mod_fastdfs.conf文件的路径,需要在安装之前修改conf配置文件中的:-DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"
4、修改配置文件
1)nginx.conf
在server中增加配置:
访问路径不带group名(storage只有一个group的情况),如/M00/00/00/xxx:
location /M00 {
ngx_fastdfs_module;
}
访问路径带group名(storage对应有多个group的情况),如/group1/M00/00/00/xxx:
location ~ /group([0-9])/M00 {
ngx_fastdfs_module;
}
2)mod_fastdfs.conf
将fastdfs-nginx-module_v1.15解压目录fastdfs-nginx-module/src下的mod_fastdfs.conf复制到-DFDFS_MOD_CONF_FILENAME配置的目录下,如/etc/fdfs/。
修改配置:
tracker_server=192.168.1.241:22122 -- tracker server的ip和端口,此处可以写多个tracker server,每行一个
url_have_group_name = true --访问路径带group时为true否则为false,多个group的情况下,必须为true,为false时,group_count必须为0
storage只有一个group的情况:
group=group1 --storage对应的group
store_path0=/webapp/fastdfs/storage --storage存储路径
group_count = 0
storage对应有多个group的情况:
url_have_group_name = true --必须设置为true才能支持多个group
group_count = 2 --storage的group个数
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage
[group2]
group_name=group2
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage2
5、重启Nginx,验证即可。
具体步骤如下:
1、安装FastDFS(我装的是最新的版本FastDFS_v4.06),具体安装步骤这里就不重复了。
2、安装Nginx(我装的版本是:nginx-1.4.2),可直接以root用户按默认安装,我是非root用户指定目录编译安装:
1)下载nginx安装包及依赖包(nginx-1.4.2.tar.gz、pcre-8.33.tar.gz、zlib-1.2.8.tar.gz)
2)分别解压:
# tar zxvf nginx-1.4.2.tar.gz
# tar zxvf pcre-8.33.tar.gz
# tar zxvf zlib-1.2.8.tar.gz
3)编译安装
# cd nginx-1.4.2
#./configure --prefix=/webapp/nginx --with-pcre=/webapp/tools/pcre-8.33 --with-zlib=/webapp/tools/zlib-1.2.8
# make
# make install
4)修改nginx.conf配置文件,启动nginx验证是否安装成功
3、Nginx添加模块
1)下载安装包(我用的是fastdfs-nginx-module_v1.15)
2)解压:tar xzf fastdfs-nginx-module_v1.15.tar.gz
3)编译安装(Nginx的安装源目录,即nginx-1.4.2解压目录):
# ./configure --prefix=/webapp/nginx --add-module=/webapp/tools/fastdfs-nginx-module/src --with-pcre=/webapp/tools/pcre-8.33 --with-zlib=/webapp/tools/zlib-1.2.8
# make
# make install
说明:如果需要修改mod_fastdfs.conf文件的路径,需要在安装之前修改conf配置文件中的:-DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"
4、修改配置文件
1)nginx.conf
在server中增加配置:
访问路径不带group名(storage只有一个group的情况),如/M00/00/00/xxx:
location /M00 {
ngx_fastdfs_module;
}
访问路径带group名(storage对应有多个group的情况),如/group1/M00/00/00/xxx:
location ~ /group([0-9])/M00 {
ngx_fastdfs_module;
}
2)mod_fastdfs.conf
将fastdfs-nginx-module_v1.15解压目录fastdfs-nginx-module/src下的mod_fastdfs.conf复制到-DFDFS_MOD_CONF_FILENAME配置的目录下,如/etc/fdfs/。
修改配置:
tracker_server=192.168.1.241:22122 -- tracker server的ip和端口,此处可以写多个tracker server,每行一个
url_have_group_name = true --访问路径带group时为true否则为false,多个group的情况下,必须为true,为false时,group_count必须为0
storage只有一个group的情况:
group=group1 --storage对应的group
store_path0=/webapp/fastdfs/storage --storage存储路径
group_count = 0
storage对应有多个group的情况:
url_have_group_name = true --必须设置为true才能支持多个group
group_count = 2 --storage的group个数
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage
[group2]
group_name=group2
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage2
5、重启Nginx,验证即可。
0 0
- 分布式文件系统FastDFS+nginx配置详解
- Nginx+fastDFS-nginx-module+FastDFS配置分布式文件系统
- Nginx+fastDFS-nginx-module+FastDFS配置分布式文件系统
- 分布式文件系统FastDFS详解
- FastDFS+Nginx搭建分布式文件系统
- 二、分布式文件系统FastDFS-配置
- 分布式文件系统 FastDFS 5.09 配置
- FastDFS+Nginx轻量级分布式文件系统安装使用
- FastDFS+Nginx轻量级分布式文件系统安装使用
- 分布式文件系统 FastDFS 与nginx 结合
- fastdfs nginx 搭建分布式文件系统(单机模式)
- ubuntu16.04+fastdfs+nginx分布式文件系统
- nginx+FastDFS+fastdfs-nginx-module配置分布式文件存储
- 【FastDFS分布式文件系统之一】:搭建、部署、配置
- 分布式文件系统FastDFS配置与使用
- FastDFS分布式文件系统集群安装与配置
- FastDFS分布式文件系统集群安装与配置
- FastDFS分布式文件系统集群安装与配置
- 使用CXF做 webservice 简单例子
- linux enterprise 5 上安装 oracle RAC
- cocos2d-x学习笔记17:记录存储2:SQLite基本使用
- 【架构】关于RabbitMQ
- Android中小功能总结
- 分布式文件系统FastDFS+nginx配置详解
- 十七周——排序
- mysql中替换某个字段中的某一些内容 .
- openssl 获取base64编码证书
- vs2008使用问题总结
- CSS色彩大全-终于叫出这些色的名字了...
- 第十七周-(项目一(2))从大到小排列三个整数。(指针方法)
- android输入法弹出后,不影响activity原有布局
- 数据库名,全局数据库名,SID区别