TFS-nginx-tfs Module
1. Install yajl
Yajl is an open-source JSON library.
Please download here: http://lloyd.github.io/yajl/ (official website)
: Http://download.csdn.net/detail/wei_xiaox126/8304485
Decompress the file
Unzip yajl-master.zip
./Configure
Make & make install
Prompt that cmake is not installed, apt-get install cmake
Some test errors are prompted, which can be ignored directly.
2. Install nginx/tengine
1) install 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) install nginx
Download the following nginx-1.3.0 version. (The Official website can be directly connected to Baidu). Download the link below, which is available for testing.
Local Connection: http://download.csdn.net/detail/wei_xiaox126/8304537
3)
Download nginx-tfs module: https://github.com/alibaba/nginx-tfs (official website)
Local Link: 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) Configure nginx
Specific configuration details see here: https://github.com/alibaba/nginx-tfs/blob/master/ReadMe.markdown
Vim/usr/local/tengine/conf/nginx. conf
Add the following content: (the configuration file must be correct)
Http {
Tfs_upstream tfs_ns {
Server 10.0.0.62: 8108;
Type ns;
# Rcs_zone name = tfss1 size = 128 M;
# Rcs_interface eth0;
# Rcs_heartbeat lock_file =/logs/lk. file interval = 10 s;
}
Tfs_body_buffer_size 2 m;
Tfs_send_timeout 3 s;
Tfs_connect_timeout 3 s;
Tfs_read_timeout 3 s;
Server {
Listen 80;
Server_name xxx. xxx;
Client_max_body_size 4096 m;
Tfs_keepalive max_cached = 50 bucket_count = 10;
# Tfs_log can be absent
Tfs_log "pipe: /usr/sbin/cronolog-p 30 min/usr/local/tengine/logs/cronolog/% Y/% m/% Y-% m-% d-% H-% m-tfs_access.log ";
Location /{
Tfs_pass tfs: // tfs_ns;
}
}
3. Start nginx
E) API Test
Use tfs-tools to upload a file and obtain the file name
Open your browser:
Xxx. xxx: 80/v1/tfs/'filename'
Successful!