FastDFS + Nginx 安装
1、安装FastDFS依赖lib包
cd
/usr/local/src/
git clone https://github.com/happyfish100/libfastcommon.git
cd
libfastcommon/
./make.sh
./make.sh
install
2、安装FastDFS
cd
/usr/local/src
wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.08/FastDFS_v5.08.
tar
.gz
tar
-zxvf FastDFS_v5.08.
tar
.gz
cd
FastDFS
./make.sh
./make.sh
install
3、tracker配置
sed
-i
's#/usr/local/bin/#/usr/bin/#g'
/etc/init.d/fdfs_trackerd
mkdir
-p
/data/fastdfs/tracker
cd
/etc/fdfs/
cp
tracker.conf.sample tracker.conf
vim tracker.conf
disabled=
false
#
启用配置文件
port=22122
#
设置 tracker 的端口号
base_path=/data/fastdfs/tracker
#
设置 tracker 的数据文件和日志目录(需预先创建)
http.server_port=80
#
设置 http 端口号
/etc/init.d/fdfs_trackerd
start
4、storage配置
sed
-i
's#/usr/local/bin/#/usr/bin/#g'
/etc/init.d/fdfs_storaged
mkdir
-p
/data/fastdfs/base
mkdir
-p
/data/fastdfs/data
cd
/etc/fdfs/
cp
storage.conf.sample storage.conf
vim storage.conf
disabled=
false
#
启用配置文件
group_name=group1
#
组名,根据实际情况修改
port=23000
#
设置 storage 的端口号
base_path=/data/fastdfs/base
#
设置 storage 的日志目录(需预先创建)
store_path_count=1
#
存储路径个数,需要和 store_path 个数匹配
store_path0=
/fastdfs/storage
#
存储路径
tracker_server=10.10.10.81:22122
#tracker
服务器的 IP 地址和端口号
http.server_port=80
#
设置storage上启动的http服务的端口号,如安装的nginx的端口号<br><br>
/etc/init.d/fdfs_storage
start
5、client配置
cp -r client.conf.sample cilent.conf
grep -Ev '^$|^#' /etc/fdfs/client.conf
mkdir /data/fastdfs/fdfs_client
vim cilent.conf
base_path=/data/fastdfs/fdfs_client
#
日志路径
tracker_server=172.16.1.40:22122
#
追踪服务器的IP,有多个服务器可以另一行
6、上传文件
[root@img01 fdfs]
# fdfs_upload_file /etc/fdfs/client.conf /etc/passwd
G1/M00/00/00/rBABKVe79c-ATItLAAAETQvMt7M7741798
返回上面内容为上传成功
7、下载文件
[root@img01 fdfs]
# fdfs_download_file /etc/fdfs/client.conf
G1/M00/00/00/rBABKVe79c-ATItLAAAETQvMt7M7741798
查看客户端信息
fdfs_monitor /etc/fdfs/client.conf
8、安装Nginx(略)
9、安装fastdfs-nginx-module
fastdfs-nginx_module作用:在storage之间同步数据时候,还没同步完全时候就发生下载时,直接从源数据storage下载
将fastdfs-nginx-module压缩包解压,并记录下它的路径,因为安装的时候要用到
下载地址:https://github.com/happyfish100/fastdfs-nginx-module/
进入nginx的安装包的源目录,然后编译和安装fastdfs-nginx-module
命令如下:
注意:要先关闭所有的nginx进程,在进行下面这一步骤
cd nginx-1.9.15
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
(/usr/local/src/fastdfs-nginx-module/src根据自己的文件目录来配)
make
make install
复制 fastdfs-nginx-module 源码中的配置文件到/etc/fdfs 目录, 并修改
修改以下配置:
connect_timeout=10 #
客户端访问文件连接超时时长(单位:秒)
base_path=/tmp #
临时目录
tracker_server=192.168.0.200:22122 # tracker
服务
IP
和端口
storage_server_port=23000 # storage
服务端口
group_name=group1 #
组名
url_have_group_name=true #
访问链接前缀加上组名
store_path0=/fastdfs/storage #
文件存储路径
复制 FastDFS 的部分配置文件到/etc/fdfs 目录
cp http.conf mime.types /etc/fdfs/
在/fastdfs/storage文件存储目录下创建软连接,将其链接到实际存放数据的目录
ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00
配置nginx访问storage文件
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8888;
server_name 112.74.53.234;
location ~/group([0-9])/M00 {
root /fastdfs/storage/data
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
启动nginx /usr/local/nginx/nginx /etc/fdfs/storage.conf 的store_path0=/fastdfs/storage 不用写/fastdfs/storage/data 会自动生成data
/etc/fdfs/mod_fastdfs.conf 的store_path0=/fastdfs/storage nginx.conf
root /fastdfs/storage/data 以上路径要正确设置,不正确下载时会 404 ,还有就是 权限问题,nginx.conf 配置 user root;
FastDFS + Nginx 安装的更多相关文章
- [转]Centos7 fastdfs/nginx 安装与配置
https://blog.csdn.net/alex_bean/article/details/78625131 参考文章 分布式文件系统-FastDFS 使用FastDFS搭建图片服务器单实例篇 C ...
- FastDFS+Nginx安装配置
下载相关包: libevent-2.0.22-stable.tar.gz => https://github.com/libevent/libevent/releases/download/re ...
- linux上安装fastdfs+nginx+ngin-module实践并解决多个异常篇
为什么选择Nginx Nginx 是一个很牛的高性能Web和反向代理服务器, 它具有有很多非常优越的特性: 在高连接并发的情况下,Nginx是Apache服务器不错的替代品:Nginx在美国是做虚拟主 ...
- 安装FastDFS+Nginx
安装FastDFS FastDFS开发者的GitHub地址为:https://github.com/happyfish100 打开上述链接,我们点击fastdfs–>release,发现最新版的 ...
- Centos安装FastDFS+Nginx(一天时间搞定)
最近在研究和使用Fastdfs,别人搭的环境,终究是别人的,绝知此事要躬行~躬行啊~ 下面的脚本主要参考了官方的INSTALL文件,这个是比较权威的,部分地方和实际情况不一致.比如配置文件的 ...
- nginx安装与fastdfs配置--阿里云
上一篇文章:fastDFS 一二事 - 简易服务器搭建之--阿里云 做了fastDFS的服务安装和配置,接下来我们来看nginx的安装 第一步:安装nginx需要安装的一些环境: 1.例如: yum ...
- FastDFS+nginx整合模块安装
FastDFS安装 安装gcc编译器 yum -y install gcc automake autoconf libtool make 上传解压两个文件包 libfastcommon是从FastDF ...
- FastDFS+Nginx(单点部署)事例
FastDFS是由淘宝的余庆先生所开发,是一个轻量级.高性能的开源分布式文件系统,用纯C语言开发,包括文件存储.文件同步.文件访问(上传.下载).存取负载均衡.在线扩容.相同内容只存储一份等功能,适合 ...
- 在虚拟机中配置FastDFS+Nginx模块
先上部署图 提示一下, ip 192.168.72.138 上面部署了两个group, 分别为 group1和g2. 另外, 同组之内的 port 要保持一致. 一.安装准备 1. #每台机器都添加两 ...
随机推荐
- Oracle 数据库中在使用中文模糊查询时输入中文查询不到结果的解决方法
添加环境变量 变量名:NLS_LANG 变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
- 寄存器(CPU原理)
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- SpringMvc4.x---快捷的ViewController
@RequestMapping("/index") public String hello(){ return "index"; } 此处无任何的业务处理,只是 ...
- Win8无法访问xp共享的解决方法——win8网上邻居访问别的xp电脑要用户名和密码取消方法
新装win8,原来的win7正常连接xp下载机的共享,但在win8下进网上邻居却无法访问xp的共享,显示”用户名或密码不正确”,而密码明明是对的如图所示: 解决方法: 按Win+R启动运行,输secp ...
- _3_form_标签
什么是input标签? 处理输入信息 input有哪些类型? 选择: <input type="checkbox"> 多选框,选择爱好等 <input type= ...
- 模态框zeroModal快速引入
最基本快速接入 <%@ page language="java" contentType="text/html; charset=UTF-8" pageE ...
- linkin大话面向对象--类和对象
我们每天在撸码,那么我们在敲什么东西呢?明显的我们在写类,写一个类,写一个接口,写某个接口里面写一些属性,在某个类里面写一个方法,然后以一个对象调用方法,对于j2ee来讲的话,可能还会写一些jsp,静 ...
- MySQL中group_concat()函数的排序方法
group_concat()函数的参数是可以直接使用order by排序的.666..下面通过例子来说明,首先看下面的t1表. 比如,我们要查看每个人的多个分数,将该人对应的多个分数显示在一起,分数要 ...
- java 网络编程之UDP通信和简单的群聊程序
*/ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...
- $.ajax()实现简单计算器
1.html页面 a.html <!DOCTYPE html> <html lang="en"> <head> <meta charse ...