FastDFS5.0.5+nginx-1.6.2

下载地址:https://github.com/happyfish100/libfastcommon.git

安装环境:

tracker:192.168.12.241
Strorage:192.168.12.252
                  192.168.12.244

一、安装FastDFS

1.安装 libfastcommon-master.zip

 

  unzip libfastcommon-master.zip -d /usr/local
  cd /usr/local/libfastcommon-master
  ./make.sh
  ./make.sh install
  ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
  ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so

 2.安装FastDFS

 

 

  tar -zxvf FastDFS_v5.05.tar.gz -C /usr/local
  cd /usr/local/FastDFS
  ./make.sh
  ./make.sh install
  ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
  ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

 3.配置相关文件

 

 

  cd /usr/local/FastDFS/conf
  cp http.conf mime.types /etc/fdfs/

 二、配置
1.配置tracker

  cd /etc/fdfs/
  vi tracker.conf
  /////////////////////////////////////
  base_path=/fastdfs_tracker
  /////////////////////////////////////

 2.配置storage

  cd /etc/fdfs/
  vi storage.conf
  ////////////////////////////////////
  base_path=/mnt/fastdfs_storage_info
  store_path0=/mnt/fastdfs_storage_data
  tracker_server=192.168.12.241:22122
  ////////////////////////////////////

 3.配置client

  cd /etc/fdfs/
  vi client.conf
  ////////////////////////////////////
  base_path=/tmp/fastdfs
  tracker_server=192.168.12.241:22122
  ////////////////////////////////////

 三、启动服务

1.tracker

 fdfs_trackerd /etc/fdfs/tracker.conf

 2.storage

 fdfs_storaged /etc/fdfs/storage.conf

 3.client
  上传:

 fdfs_upload_file client.conf /home/nginx/FastDFS_v5.04.tar.gz

   输出:group1/M00/00/00/wKgBHlQvrQGARrS6AAU9tcFAzok.tar.gz
  下载:

 fdfs_download_file client.conf group1/M00/00/00/wKgBHlQvrQGARrS6AAU9tcFAzok.tar.gz /tmp/FastDFS_v5.04.tar.gz

 四、在Storage上安装fastdfs-nginx-module

  unzip fastdfs-nginx-module-master.zip -d /usr/local
  cp /usr/local/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/

    配置mod_fastdfs.conf

  vi /etc/fdfs/mod_fastdfs.conf
  /////////////////////////////////////
  tracker_server=192.168.12.241:22122
  url_have_group_name=true
  base_path=/mnt/fastdfs_storage_info
  store_path0=/mnt/fastdfs_storage_data
  /////////////////////////////////////

 五、在Storage上安装nginx

1.需要以下支持包

   openssl-devel
   pcre-devel
   zlib-devel

2.安装nginx

  tar -zxvf nginx-1.6.2.tar.gz -C /usr/local/
  cd /usr/local/nginx-1.6.2/
  ./configure --prefix=/usr/local/nginx --add-module=/usr/local/fastdfs-nginx-module-master/src
  make&make install

 3.配置nginx.conf

  ////////////////////////////////////////
  #      location / {
  #          root   html;
  #          index  index.html index.htm;
  #      }

        location /group {
            root /mnt/fastdfs_storage_data/data;
            ngx_fastdfs_module;
        }
  ////////////////////////////////////////

 六、测试:
1.http://192.168.12.252/group1/M00/00/00/wKgM9FVMryuAaEMTAAVFOL7FJU4.tar.gz
2.http://192.168.12.244/group1/M00/00/00/wKgM9FVMryuAaEMTAAVFOL7FJU4.tar.gz

 

 

你可能感兴趣的:(fastDFS)