FastDFS+Nginx采用fastdfs-nginx-module集成

本文主要讲述FastDFS的安装及如何与Nginx 集成,由于最新版的FastDFS已经取消了直接通过HTTP直连FastDFS的这种方式,因此需要在FastDFS增加Nginx的整合

一、安装Nginx准备东西

安装Nginx的前置条件,需要安装以下软件

yum -y install gcc

yum -y install gcc-c++

yum -y install openssl openssl-devel

yum -y install zlib-devel

yum -y install pcre-devel

下载nginx

http://nginx.org/download/nginx-1.13.12.tar.gz

下载最新版 fastdfs-nginx-module

https://github.com/happyfish100/fastdfs-nginx-module/

二、编译安装nginx

解压nginx 和fastdfs-nginx-module

进入nginx源代码目录,执行编译命令

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

make&make install

三、修改配置文件

配置Nginx.conf

location ~ /group([0-9]) /M00 {

root /home/ningqijun/fastdfs/data;

ngx_fastdfs_module;

}

修改mod_fastdfs.conf

将/home/…/fastdfs-nginx-module-master/src(位置看自己将解压到哪里)

里面的mod_fastdfs.conf复制到/etc/fdfs/里面

1. 更改tracker_server的IP如:tracker_server=172.16.36.245:22122

2. 更改store_path0这个要与storaged的配置一致,如:store_path0=/home/ningqijun/fastdfs

修改mod_fastdfs.conf

mod_fastdfs.conf 里面指定了url_have_group_name= true

复制FastDFS配置文件到etc目录下

将FastDFS配置目录下的2个文件复制到/etc/fdfs目录下:

cp /usr/local/fastdfs /conf/http.conf /etc/fdfs/

cp /usr/local/fastdfs/conf/mime.types /etc/fdfs/

四、启动Nginx

./nginx

你可能感兴趣的:(Linux)