FastDFS+Nginx安装配置
下载相关包:
libevent-2.0.22-stable.tar.gz =》 https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
https://sourceforge.net 下载相应的FASTDFS文件:
fastdfs_client_java._v1.25.tar.gz
fastdfs-nginx-module_v1.16.tar.gz
FastDFS_v5.08.tar.gz
nginx-1.11.6.tar.gz
libfastcommon-master =》https://github.com/happyfish100/libfastcommon/archive/master.zip
拓扑图

1.解压安装
a. libevent:
rpm -e --nodepes `rpm -qa | grep libevent
cd libevent1.4.14b
./configure --prefix=/usr
make clean
make
make install
2.FastDFS_v5.08
cd FastDFS
./make.sh
./make.sh install
有报错信息
compilation terminated.
make: *** [../common/fdfs_global.o] Error 1
需要安装 libfastcommon-master
3. libfastcommon-master
unzip master.zip
cd libfastcommon-master/
./make.sh
./make.sh install
然后继续安装FASTDFS
配置fastdfs:
配置tracker: # cd /etc/fdfs/ # cp tracker.conf.sample tracker.conf 修改配置文件 disabled=false #启用配置文件 port=22122 #设置tracker的端口号 base_path=/data/fastdfs/trackerd #设置tracker的数据文件和日志目录(需预先创建) http.server_port=8090 #设置http端口号 启动:
# mkdir -p /data/fastdfs/trackerd
# fdfs_trackerd /etc/fdfs/tracker.conf #启动
# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
设置开机启动
# echo '/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart' >> /etc/rc.d/rc.local
配置storage:
1.安装 与tracker 安装步骤相同
disabled=false #启用配置文件
group_name=group1 #组名,根据实际情况修改
port=23000 #设置storage的端口号
base_path=/data/fastdfs/storage #设置storage的日志目录(需预先创建)
store_path_count=1 #存储路径个数,需要和store_path个数匹配
store_path0=/data/fastdfs/storage #存储路径
tracker_server=172.16.8.8:22122 #tracker服务器的IP地址和端口号
http.server_port=8090 #设置http端口号
启动
# mkdir -p /data/fastdfs/storage
# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
设置开机启动
# echo '/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart' >> /etc/rc.d/rc.local
查看状态
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
# netstat -antp | grep storage
上传测试(配置Client,client.conf)
cp client.conf.sample client.conf
base_path=/home/yuqing/fastdfs-> base_path=/data/fastdfs_tracker
tracker_server=192.168.209.121:22122 -> tracker_server=172.16.8.8:22122
http.tracker_server_port=8080 ->http.tracker_server_port=8090
然后测试上传
fdfs_test /etc/fdfs/client.conf upload a.jpg
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf
4. 安装Nginx
cd useradd -r nginx
useradd -r nginx
./configure --prefix=/usr/local/nginx --add-module=/data/fastdfs-nginx-module/src
make
make install NOTE:
安装Nginx时报错
./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题
yum -y install pcre-devel
错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
解决办法:
yum -y install openssl openssl-devel
总结:
yum -y install pcre-devel openssl openssl-devel
./configure --prefix=/usr/local/nginx
make
make install
一切搞定
Note:
/usr/local/src/fastdfs-nginx-module/src/common.c:21:25: 错误:fdfs_define.h:没有那个文件或目录
[root@server1 src]# cp -rf /usr/include/fast* /usr/local/include/
[root@server1 src]# ls /usr/local/include/
fastcommon fastdfs
然后再次编译Nginx
配置:
vim /usr/local/nginx/conf/nginx.conf
location ~ /group[1-3]/M00 {
root /data/fastdfs/storage/data;
ngx_fastdfs_module;
}
/data/fastdfs/storage/data 这个是指向 真正存储文件的地方
建立 M00 至存储目录的符号连接
[root@server1 fdfs]# ln -s /data/fastdfs/storage/data /data/fastdfs/storage/data/M00
[root@server1 fdfs]# ll /data/fastdfs/storage/data/M00
配置mod_fastDfs.config:
base_path=/data/fastdfs/storage #保存日志目录
tracker_server=10.10.10.124:22122 #tracker 服务器的 IP 地址以及端口号
storage_server_port=23000 #storage 服务器的端口号
group_name=group1 #当前服务器的 group 名
url_have_group_name = true #文件 url 中是否有 group 名
store_path_count=1 #存储路径个数,需要和 store_path 个数匹配
store_path0=/data/fastdfs/storage #存储路径
http.need_find_content_type=true # 从文件 扩展 名查 找 文件 类型 ( nginx 时 为true)
group_count = 1 #设置组的个数
启动存储服务器上的nginx时确报了下面的错误:
ngx_http_fastdfs_process_init pid=17609
[2014-12-10 11:52:07] ERROR - file: ini_file_reader.c, line: 315, include file "http.conf" not exists, line: "#include http.conf"
解决方案:
FDFS安装包的conf目录下,有几个配置文件,把http.conf,mime.types,拷贝到/etc/fdfs/下,http.conf里有
个配置应该是token验证的功能,如果你要打开,应该把路径配置正确
测试:
[root@mobancentos70 data]# fdfs_upload_file /etc/fdfs/client.conf 1.png
group1/M00/00/00/rBQN5lhI0VeAOOWNAAVg32hqxR4098.png
http://172.20.13.230/group1/M00/00/00/rBQN5lhI0VeAOOWNAAVg32hqxR4098.png
附录:
在整个环境搭建过程中遇到一些问题,在此提交分享,供大家参考。
1、 在Storage服务器上启动Nginx时出现 ERROR - file: /home/hadoop/dev/fastdfs/fastdfs-nginx-module/src/common.c, line: 103, section: group1, you must set parameter: group_name!
问题原因:在配置mod_fastdfs.conf文件时要保证group_count=2的个数与下面配置的[group*]个数相一致。
2、 安装GraphicsMagick进行配置时出现错误 configure: error: libltdl is required by modules build 问题原因:没有安装libltdl,通过yum install
-ylibtoollibtool-devel安装后再重新
3、 java客户端上传文件时出现错误 recvcmd: 100 is not correct, expect cmd: 10
问题原因:版本问题,下载1.24版本的即可。
4、 通过浏览器方式缩略图是出现
gm convert: Request did not return an image.错误。
问题原因:没有安装libjpeg和libpng包,导致在GM处理图时出现错误。安装libjpeg和libpng后重新安装GraphicsMagick即可。
5、 安装FastDFS在 编译时出现
/usr/local/lib/libfastcommon.so: undefined reference
to sqrt' /usr/local/lib/libfastcommon.so: undefined reference
tocos'错误
问题原因:libfastcommon版本的问题,下载旧版本,重新安装,然后在编译FastDFS即可。
FastDFS+Nginx安装配置的更多相关文章
- Nginx安装配置(转)
Nginx 安装配置 Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/ ...
- Nginx安装配置PHP(FastCGI)环境的教程
这篇是Nginx安装配置PHP(FastCGI)环境的教程.Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用. 一.什么是 FastCGI F ...
- Nginx安装配置与HelloWorld
<深入理解Nginx>阅读与实践(一):Nginx安装配置与HelloWorld 最近在读陶辉的<深入理解Nginx:模块开发与架构解析>,一是想跟着大牛练练阅读和编写开源代码 ...
- Nginx 安装 配置 使用
Nginx 安装 配置 使用 基本的HTTP服务器特性 处理静态文件,索引文件以及自动索引:打开文件描述符缓存(缓存元数据和文件描述符,下一次可以直接从内存找到数据或者文件的位置): 使用缓存加速反向 ...
- VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)
首先启动Nginx 1. 相关浏览 两个 Tomcat 配置: VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...
- VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)
准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...
- Hearbeat + Nginx 安装配置
Hearbeat + Nginx 安装配置 实验环境 两台主机:Linux Centos 6.5 32位 主 服务端:Hearbeat + Nginx eth0:192.168.1.160(公网) e ...
- Nginx安装配置|Nginx反向代理|Nginx支持HTTPS|Nginx重定向
Nginx安装配置 可以直接看到最下面的HTTPS. Nginx安装 我的系统如下: No LSB modules are available. Distributor ID: Ubuntu Desc ...
- puppet 3+Unicorn+Nginx安装配置
puppet 3+Unicorn+Nginx安装配置 2014-08-15 10:58 酒瓶不倒 酒瓶不倒的博客 字号:T | T 一键收藏,随时查看,分享好友! Unicorn 效率要比 Webri ...
随机推荐
- python入门(12)dict
python入门(12)dict Python内置了字典:dict的支持,dict全称dictionary,在其他语言中也称为map,使用键-值(key-value)存储,具有极快的查找速度. 举个例 ...
- Django之views系统
Django的View(视图)简介 一个视图函数(类),简称视图,是一个简单的Python 函数(类),它接受Web请求并且返回Web响应. 响应可以是一张网页的HTML内容,一个重定向,一个404错 ...
- 一个适用于单页应用,返回原始滚动条位置的demo
如题,最近做一个项目时,由于页面太长,跳转后在返回又回到初始位置,不利于用户体验,需要每次返回到用户离开该页面是的位置.由于是移动端项目,使用了移动端的套ui框架framework7,本身框架的机制是 ...
- Python系列之 - 面向对象(1)
python是一门面向对象的编程语言,python中的一切均是对象. 有对象就提到类,对象和类就像是儿子和老子的关系,是不可分的一对. 什么是类 类就是具有一些共同特性的事物的统称.好比人类, ...
- python基础——匿名函数及递归函数
python基础--匿名函数及递归函数 1 匿名函数语法 匿名函数lambda x: x * x实际上就是: def f(x): return x * x 关键字lambda表示匿名函数,冒号前面的x ...
- 使用Vertx重构系统小结
背景 前几个月,使用Vertx重构了公司的一个子系统,该系统负责公司核心数据subscriber的采集.处理.存储和搜索.这里介绍下重构该系统时的一些关键点. 架构 重构前系统部署图: 重构前系统主要 ...
- SQL Server 2008 R2 安装注意事项
上个星期自己第一次安装SQL Server 2008 R2,安装失败几次,结果用了将近1天的时间安装,最后成功了. 心得:1.安装SQL Server 2008 R2时,最好在第一次就安装成功.在百度 ...
- 1018关于MySQL复制搭建[异步复制和半同步复制]
转自:http://www.cnblogs.com/ivictor/p/5735580.html 搭建MySQL数据库的主从架构,还是蛮简单的.重要的几个命令整理一下. 主从服务器上: SHOW VA ...
- 原来你是这样的Promise
1. Promise简介 promise是异步编程的一种解决方案,它出现的初衷是为了解决回调地狱的问题. 打个比方,我需要: --(延迟1s)--> 输出1 --(延迟2s)--> 输出2 ...
- Windows下Java开发环境安装与配置
1. 前往Oracle网站下载JDK程序并安装. http://www.oracle.com/technetwork/java/javase/downloads/index.html 目前最新的版本为 ...