---
title: "nginx集成TFS分布式文件访问module"
author: "nicegege"
date: "2015-08-03T15:15:03Z"
tags: ["TFS"]
categories: ["开源软件"]
slug: "nginx-tfs-module"
draft: false
lastmod: "2015-08-03T15:15:03Z"
id: 2232464
url: "https://nicegege.iteye.com/blog/2232464"
---

1.先安装lloyd-yajl的libary，因为tfs-nginx-model需要。安装的时候，用到cmake命令。需要安装

```
[root@localhost local]# tar -zxvf lloyd-yajl-2.1.0-0-ga0ecdde.tar.gz 
```

```
yum -y install make gcc-c++ cmake
```

```
[root@localhost lloyd-yajl-66cb08c]#./configure
make & make install
```

2.解压nginx模块，这里选择的nginx版本为1.4.7.像高版本的nginx不能支持tfs-module.

```
[root@localhost local]# tar -zxvf nginx-1.4.7.tar.gz 
```

3.解压nginx-tfs-module

```
[root@localhost local]# unzip nginx-tfs-master.zip
```

4.安装pcre,openssl,per-devel,gd-devel等

```
yum -y install pcre pcre-devel  openssl openssl-devel  perl perl-devel perl-ExtUtils-Embed 
```

```
安装gd-devel的时候，无法下载gd-devel的rpm包，所以先下载gd-devel再install安装
```

```
wget ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/gd-devel-2.0.35-11.el6.i686.rpm
yum install gd-devel
```

5.安装nginx，同时安装tfs插件

```
./configure  --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_stub_status_module --with-http_image_filter_module --add-module=/opt/local/nginx-tfs-master 
```

报错：

```
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
```

其实已经安装了GD library。但是找不到GD library。

下载gd  library，安装就好了。

6.启动nginx是报错：

```
[root@localhost sbin]# ./nginx 
./nginx: error while loading shared libraries: libyajl.so.2: cannot open shared object file: No such file or directory
```

 找不到lib64内的libyajl.so.2

```
cp /usr/local/lib/libyajl.so.2 /lib64
```

报错：

 

```
./nginx: error while loading shared libraries: libgd.so.3: cannot open shared object file: No such file or directory
```

 同样找不到libgd.so.3，和上面的操作一样。

```
cp /usr/local/lib/libgd.so.3 /lib64
```

7.运行nginx,检测结果

```
[root@localhost sbin]# ./nginx 
[root@localhost sbin]# ps -ef|grep nginx
root     34474     1  0 15:12 ?        00:00:00 nginx: master process ./nginx
nobody   34475 34474  0 15:12 ?        00:00:00 nginx: worker process
root     34479 26794  0 15:12 pts/4    00:00:00 grep nginx
```

 过程中有很多小挫折，比如自己下载安装的gd-library,libyajl的都要把so文件拷贝到/lib64目录下。