yajl是一个开源的JSON库
请到这里下载: http://lloyd.github.io/yajl/(官网)
下载地址:http://download.csdn.net/detail/wei_xiaox126/8304485
解压文件
unzip yajl-master.zip
./configure
make && make install
提示没有安装cmake, apt-get install cmake
提示有一些test的错误,可以直接忽略
1)安装pcre
下载地址:http://download.csdn.net/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.csdn.net/detail/wei_xiaox126/8304537
3)
下载nginx-tfs模块:https://github.com/alibaba/nginx-tfs (官网链接)
本地链接:http://download.csdn.net/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;
}
}
e) API接口测试
用tfs-tools 上传一个文件,获得文件名
打开浏览器浏览:
xxx.xxx.xxx.xxx:80/v1/tfs/'filename'
成功!
注:欢迎大家提出建议,支出错误
欢迎转载,注明出处,谢谢!