您当前的位置: 首页 >  nginx
  • 0浏览

    0关注

    516博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

FastDFS----使用Nginx提供服务

不太灵光的程序员 发布时间:2019-03-20 15:42:38 ,浏览量:0

首先需要安装Nginx 1、下载 Nginx

nginx-1.10.0.tar.gz 下载 fastdfs-nginx-module:https://github.com/happyfish100/fastdfs-nginx-module fastdfs-nginx-module-master

2、编译

./configure --prefix=/usr/local/nginx --with-pcre --add-module=/home/lot/project/fastdfs-nginx-module-5e5f3566bbfa57418b5506aaefbe107a42c9fcb1/src

3、安装

make && make install 可能会出现以下问题

	-o objs/src/http/modules/ngx_http_upstream_zone_module.o \
	src/http/modules/ngx_http_upstream_zone_module.c
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I /usr/include/fastdfs -I /usr/include/fastcommon/ \
		-o objs/addon/src/ngx_http_fastdfs_module.o \
		/home/lot/project/fastdfs-nginx-module-master/src/ngx_http_fastdfs_module.c
In file included from /home/lot/project/fastdfs-nginx-module-master/src/ngx_http_fastdfs_module.c:6:0:
/home/lot/project/fastdfs-nginx-module-master/src/common.c: In function ‘fdfs_http_request_handler’:
/home/lot/project/fastdfs-nginx-module-master/src/common.c:1245:61: error: ‘FDFSHTTPParams’ has no member named ‘support_multi_range’
                 (pContext->range_count > 1 && !g_http_params.support_multi_range))
                                                             ^
make[1]: *** [objs/addon/src/ngx_http_fastdfs_module.o] Error 1
make[1]: Leaving directory `/home/lot/project/nginx-1.10.0'
make: *** [build] Error 2

在这里插入图片描述 解决方法 https://blog.csdn.net/hohoo1990/article/details/51444793

修改配置 1、创建软连接

创建一个软连接,在/fastdfs/storage文件存储目录下创建软连接,将其链接到实际存放数据的目录 示例:ln -s /home/fastdfs/storage/data/ /home/fastdfs/storage/data/M00

2、修改Nginx配置文件

vi /mnt/FastDFS/conf/fdfs_nginx.conf server { listen 80; server_name localhost;

    location ~ /group[0-9]/M00 {
        ngx_fastdfs_module;
    }

}

3、修改mod文件

命令:vi /etc/fdfs/mod_fastdfs.conf 修改内容:比如连接超时时间、跟踪器路径配置、url的group配置 connect_timeout=10 tracker_server=IP:22122 url_have_group_name = true store_path0=/home/yuqing/fastdfs/storage

4、重启Nginx

查看 nginx 及 子进程 ps -aux|grep nginx 重启 /mnt/FastDFS/nginx/nginx-1.10.3/objs/nginx -c /mnt/FastDFS/conf/fdfs_nginx.conf

测试访问 1、上传文件

在这里插入图片描述

2、文件预览

在这里插入图片描述

关注
打赏
1664870321
查看更多评论
立即登录/注册

微信扫码登录

0.0391s