Nginx与FastDFS简单整合

上一次介绍了关于FastDFS系统单机版的安装配置以及使用官方测试上传图片:
Linux下FastDFS系统的搭建
上传成功返回的链接还无法访问,因为FastDFS不支持http协议,所以要想直接访问,还需要使用nginx访问传的图片,文件。


nginx的搭建

这里就不介绍了,传送门:CentOS下Nginx的配置安装

fastdfs-nginx-module

下载地址:https://github.com/happyfish100/fastdfs-nginx-module
这里我从新安装nginx服务器,命令如下:如果是在现有的nginx上添加,可能会比较麻烦

[root@localhost nginx]# wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip
[root@localhost nginx]# unzip master.zip
[root@localhost nginx]# cd nginx-1.9.0/
[root@localhost nginx-1.9.0]#  ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-pcre=/usr/local/nginx/pcre-8.41 --add-module=/usr/local/nginx/fastdfs-nginx-module-master/src
[root@localhost nginx-1.9.0]# make
[root@localhost nginx-1.9.0]# make install

安装完成之后要三个配置文件拷贝到fastDFS的配置文件目录下,我这里是/etc/fdfs

[root@localhost nginx-1.9.0]# cp /usr/local/nginx/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs

[root@localhost src]# cp /usr/local/fastdfs/fastdfs-5.11/conf/http.conf /etc/fdfs/

[root@localhost src]# cp /usr/local//fastdfs/fastdfs-5.11/conf/mime.types /etc/fdfs/

修改mod_fastdfs.conf 配置信息:

[root@localhost bin]# vim /etc/fdfs/mod_fastdfs.conf 
base_path=/data/fastdfs/storage
tracker_server=192.168.18.130:22122
store_path0=/data/fastdfs/storage

然后建立软连接:指向文件保存路径

[root@localhost nginx-1.9.0]# ln -s /data/fastdfs/storage/data/ /data/fastdfs/storage/data/M00

最后修改nginx的配置文件:添加location

测试

启动nginx:
[root@localhost src]# /usr/local/webserver/nginx/sbin/nginx -s reload
再次使用客户端测试类上传一张图片或者文件:

在浏览器访问返回的链接:


关于nginx+FastDFS的简单配置介绍完成!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值