fastdfs-nginx-module作用:
在storage之间同步数据时候,还没同步完全时候就发生下载时,直接从源数据storage下载
软件包下载:
下载fastdfs-nginx-module
下载nginx
将fastdfs-nginx-module与nginx压缩包均上传至/home目录下,如图:
配置fastdfs-nginx-module
1.修改fastdfs-nginx-module/src/conf
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz cd
fastdfs-nginx-module/src/
vi config
去掉CORE_INCS后面的local,如图
2.复制并修改fastdfs-nginx-module/src/conf下的mod_fastdfs.conf
cp mod_fastdfs.conf /etc/fdfs/
cd /etc/fdfs/
vi mod_fastdfs.conf
修改如下几项:
tracker_server=10.0.3.101:22122
store_path0=/home/yuqing/fastdfs
base_path=/home/yuqing/fastdfs
url_have_group_name = true
3.建立软连接(配置文件中storage存放数据的路径):
ln -s /home/yuqing/fastdfs/data /home/yuqing/fastdfs/data/M00
4.将FastDFS配置目录下的2个文件复制到/etc/fdfs目录下:
cd /home/FastDFS/conf
cp http.conf /etc/fdfs/
cp mime.types /etc/fdfs/
安装和配置nginx
1.执行下面命令,安装nginx所需要的环境:
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
2.配置nginx(–prefix指定nginx安装到哪里, –add-module指定fastdfs-nginx-module的目录)
./configure --prefix=/usr/local/nginx --add-module=/home/fastdfs-nginx-module/src/
make&&make install
3.修改nginx配置文件
cd /usr/local/nginx/conf
vi nginx.conf
在server节点加入下面的配置
location /group1/M00{
root /usrdata/fastdfs/data;
ngx_fastdfs_module;
}
4.启动nginx
/usr/local/nginx/sbin/nginx
ok!