CentOS 5下安装tfs并使用Nginx做访问(2)

== removing old build files
== running CMake in build directory
./configure: line 41: cmake: command not found
The "cmake" program is required to configure yajl.
It's available from most ports/packaging systems and

解决办法:

yum -y install cmake

继续编译通过

下载tengine此软件是nginx的升华版本,在nginx上二次开发
wget
下载nginx-tfs模块
wget https://codeload.github.com/alibaba/nginx-tfs/zip/master
安装tengine并添加ngix-tfs模块
[root@localhost tengine-2.0.3]# ./configure --prefix=/usr/local/nginx --add-module=/opt/nginx-tfs-master && make && make install
报错
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
解决办法
[root@localhost tengine-2.0.3]# yum -y install pcre-devel
继续编译tengine
[root@localhost tengine-2.0.3]# ./configure --prefix=/usr/local/nginx --add-module=/opt/nginx-tfs-master && make && make install
启动nginx报错
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libyajl.so.2: cannot open shared object file: No such file or directory
xx解决办法
[root@localhost tengine-2.0.3]# ln -s /usr/local/lib/libyajl.so.2 /usr/lib64/libyajl.so.2
再次测试成功
启动nginx
[root@localhost tengine-2.0.3]# /usr/local/nginx/sbin/nginx

8.使用nginx访问上传图片路径

修改nginx配置文件

在nginx的http模块中添加upstream

tfs_upstream tfs_ns {
        server 192.168.1.230:8108;
        type ns;
    }

在nginx的server模块中添加tfs_pass

server {
        listen      80;
        server_name  localhost;
tfs_keepalive max_cached=100 bucket_count=10;
tfs_log "pipe:/usr/sbin/cronolog -p 30min /var/log/nginx/logs/cronolog/%Y/%m/%Y-%m-%d-%H-%M-tfs_access.log";


 location  ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
              tfs_pass tfs://tfs_ns;
          }

}

使用url访问图片

例如上传的返回值是xxxxxxxxxxxxxxxxxxxxxx.jpg

访问使用 http:/NameserverIP/v1/tfs/xxxxxxxxxxxxxxxxxxxxxx.jpg

--------------------------------------分割线 --------------------------------------

CentOS 6.2实战部署Nginx+MySQL+PHP

使用Nginx搭建WEB服务器

搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程

CentOS 6.3下Nginx性能调优

CentOS 6.3下配置Nginx加载ngx_pagespeed模块

CentOS 6.4安装配置Nginx+Pcre+php-fpm

Nginx安装配置使用详细笔记

Nginx日志过滤 使用ngx_log_if不记录特定日志

--------------------------------------分割线 --------------------------------------

Nginx 的详细介绍请点这里
Nginx 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/df026e514ee879aa40abb8de7ea94ac3.html