Linux 下fastdfs 安装 部署 测试

第一步:安装依赖包 (基础依赖):

yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip

添加fastDFS运行用户:

useradd -s /sbin/nologin fastdfs

第二步:安装FastDFS 5.05

第三步:安装fastdfs-nginx模块 、安装nginx

第四步:设置配置nginx、fastdfs文件信息

第五步:启动fastdfs
启动tracker storage.conf :
/home/xuan/soft/fastdfs-5.05/tracker/fdfs_trackerd /etc/fdfs/tracker.conf

/home/xuan/soft/fastdfs-5.05/storage/fdfs_storaged /etc//fdfs/storage.conf

上传文件:/usr/local/bin/fdfs_upload_file
下载文件:/usr/local/bin/fdfs_download_file [local_filename]
删除文件:/usr/local/bin/fdfs_delete_file
monitor: /usr/local/bin/fdfs_monitor /etc/fdfs/client.conf
关闭:
killall fdfs_trackerd
killall fdfs_storaged

/usr/local/bin/stop.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/stop.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
重启:
/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/restart.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf

第五步:测试

nginx.conf配置文件:

  ##fastdfs-begin
server {
       listen 80;
       server_name 192.168.1.102;
       root /webdata/fastdfs.com;
       index index.html index.htm;

   location / {

       if (!-e $request_filename) {
          rewrite ^(.*)$ /index.html last;
          }

   location /group1/M00 {
            root /home/data/fastdfs/storage/data/;
            ngx_fastdfs_module;
          }

   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js)$ {

        #fastcgi_cache cache_one; #nginx.conf 开启cache才行,要不然启动报错
       fastcgi_cache_valid 200 10m;
       fastcgi_cache_valid 304 3m;
       fastcgi_cache_valid 301 302 1h;
       fastcgi_cache_valid any 1m;
       fastcgi_cache_min_uses 1;
       fastcgi_cache_use_stale error timeout invalid_header http_500;
       fastcgi_cache_key $host$request_uri;
       access_log off;
       }

       }

    access_log off;

}
#fastdfs-end

你可能感兴趣的:(Linux 下fastdfs 安装 部署 测试)