`
风过无声
  • 浏览: 87937 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

FASTDFS安装(三)安装fastdfs-nginx-module

    博客分类:
  • DFS
 
阅读更多

1.准备

nginx-1.8.0.tar.gz

fastdfs-nginx-module_v1.15.tar.gz

2.安装过程

--上传安装包到/usr/local/src下

--解压

#tar -zvxf nginx-1.8.0.tar.gz

#tar -zvxf fastdfs-nginx-module_v1.15.tar.gz 

--建立makefile

#cd nginx-1.8.0

#./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src 

./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.

解决办法:安装pcre-devel 

#yum -y install pcre-devel

--重新建立makefile

#./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src 

#./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.

解决办法:安装zlib-devel

#yum install -y zlib-devel

--重新建立makefile

#./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src

--编译

#make

--安装

#make install

--编辑nginx.conf

#vi /usr/local/nginx/conf/nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location /group1/M00 {
            root /var/fastdfs/storage/data;
            ngx_fastdfs_module;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }

}

--建立数据文件的软链接

--/var/fastdfs/storage/data为storage的文件存储路径

#ln -s /var/fastdfs/storage/data  /var/fastdfs/storage/data/M00  

--配置mod_fastdfs.conf

#cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

#vi /etc/fdfs/mod_fastdfs.conf

base_path=/var/fastdfs/ngx_module
tracker_server=192.168.117.100:22122
url_have_group_name=true
store_path0=/var/fastdfs/storage

--启动nginx

#/usr/local/nginx/sbin/nginx

--访问图片

http://192.168.172.101/group1/M00/00/00/wKh1ZVWdaIiAJ0NoAAAwB0Ubngg142.jpg 

访问失败,查看nginx日志

[2015-07-11 23:52:43] ERROR - file: ../storage/trunk_mgr/trunk_shared.c, line: 177, "No such file or directory" can't be accessed, error info: /var/fastdfs/ngx_module

解决办法

#mkdir -p /var/fastdfs/ngx_module

--重启nginx

#/usr/local/nginx/sbin/nginx -s stop

#/usr/local/nginx/sbin/nginx

--访问图片

http://192.168.172.101/group1/M00/00/00/wKh1ZVWdaIiAJ0NoAAAwB0Ubngg142.jpg

成功

3.参考资料

http://blog.csdn.net/hfsu0419/article/details/7190152

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics