TFS - nginx-tfs模块

本文档详细介绍了如何在Linux环境下安装yajl库、nginx/tengine以及nginx-tfs模块。首先,从指定链接下载并安装yajl,接着安装pcre和nginx,然后下载并配置nginx-tfs模块,最后启动nginx并进行API接口测试,确保配置正确。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装yajl

yajl是一个开源的JSON库

请到这里下载: http://lloyd.github.io/yajl/(官网)

下载地址:http://download.youkuaiyun.com/detail/wei_xiaox126/8304485

解压文件

unzip yajl-master.zip

./configure

make && make install

提示没有安装cmake, apt-get install cmake

提示有一些test的错误,可以直接忽略 


2.安装nginx/tengine

1)安装pcre

下载地址:http://download.youkuaiyun.com/detail/wei_xiaox126/8304511

tar xvf pcre-8.35.tar.gz

cd pcre-8.35

./configure --prefix=/usr/local/pcre

make

make install

2)安装nginx

官网下载nginx-1.3.0以下的版本。(官网链接可直接百度),以下链接本人下载,已测试可用

本地连接:http://download.youkuaiyun.com/detail/wei_xiaox126/8304537

3)

下载nginx-tfs模块:https://github.com/alibaba/nginx-tfs (官网链接)

本地链接:http://download.youkuaiyun.com/detail/wei_xiaox126/8304561

unzip nginx-tfs-master.zip

tar xvf nginx-1.2.9.tar.gz

cd nginx-1.2.9

./configure --prefix=/usr/local/nginx --add-module=/'you tfs path'/ 

make

make install

c)配置nginx

具体配置细节参看这里:https://github.com/alibaba/nginx-tfs/blob/master/ReadMe.markdown

vim /usr/local/tengine/conf/nginx.conf

添加以下内容:(配置文件一定要对)

http {
tfs_upstream tfs_ns {
server 10.0.0.62:8108;
type ns;
#rcs_zone name=tfs1 size=128M;
#rcs_interface eth0;
#rcs_heartbeat lock_file=/logs/lk.file interval=10s;
}

tfs_body_buffer_size 2m;

tfs_send_timeout 3s;

tfs_connect_timeout 3s;
      tfs_read_timeout 3s;

server {
listen 80;
server_name xxx.xxx.xxx.xxx;
client_max_body_size 4096m;

  tfs_keepalive max_cached=50 bucket_count=10;

  #tfs_log可以无
tfs_log "pipe:/usr/sbin/cronolog -p 30min /usr/local/tengine/logs/cronolog/%Y/%m/%Y-%m-%d-%H-%M-tfs_access.log";

   location / {
tfs_pass tfs://tfs_ns;
}
}

3.启动nginx

e) API接口测试

用tfs-tools 上传一个文件,获得文件名

打开浏览器浏览:

xxx.xxx.xxx.xxx:80/v1/tfs/'filename'

成功!


注:欢迎大家提出建议,支出错误

       欢迎转载,注明出处,谢谢!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值