fastDFS+nginx相关安装配置

1.安装libfastcommon   

   解压libfastcommon-master.zip  

   unzip libfastcommon-master.zip

   可以重命名 mv libfastcommon-master libfastcommon

   进入libfastcommon-master

   编译安装libfastcommon   ./make.sh  ./make.sh install

2.安装Fastdfs

   解压 unzip fastdfs-master.zip

   重命名 mv fastdfs-master FastDFS

   进入目录 cd FastDFS

   编译 以及安装 ./make.sh  ./make.sh install

3.修改配置文件

   配置文件在 /etc/fdfs/

   进入目录 cd /etc/fdfs/

   复制相关的配置文件

      cp client.conf.sample client.conf

      cp tracker.conf.sample tracker.conf

      cp storage.conf.sample storage.conf

   配置storage.conf

      配置group_name 是指storage属于哪个group group_name=group1

      配置base_path  base_path=/home/yuqing/fastdfs (默认)

      配置store_path0  store_path0=/home/yuqing/fastdfs(建议与上个目录一致)

      配置tracker_server tracker_server=192.168.1.123:22122

      注意上述目录需要手动创建

   配置tracker.conf

      配置base_path=/home/yuqing/fastdfs(同样需要创建如已创建请忽略)

   配置client.conf

     配置base_path=/home/yuqing/fastdfs

     配置tracker_server=172.16.36.245:22122

 4.启动应用程序

启动tracker server

  /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

启动storage server

 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

5.测试应用

  /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/1.jpg

 当出现一下画面,便成功了

 

http://192.168.1.123/group1/M00/00/00/wKgBe1q0lTmAVUsKAATdp5YKaPM492_big.jpg

此时该地址是不能访问的需要配置nginx

 

6.安装nginx(准备)

 安装SSL功能需要的openssl库插件

   解压  tar -zxvf openssl-1.1.1-pre4.tar.gz

   进入目录  cd openssl-1.1.1-pre4

   执行以下操作 ./config  make  make install

安装pcre-8.39

  cd  pcre-8.39 执行以下操作 ./configure make   sudo make install

安装zlib-1.2.11

  cd zlib-1.2.11  执行以下操作 ./configure make   sudo make install

注意 需要c++编译环境 yum install -y gcc gcc-c++

7.安装nginx

  进入目录  cd nginx-1.13.11

  执行以下操作 ./configure make   sudo make install

  修改目录权限

    chmod a+rwx -R /usr/local/nginx/logs/

chmod a+rwx -R /usr/local/nginx/

  检测配置文件是否正确

    /usr/local/nginx/sbin/nginx -t   出现以下便成功了

     启动nginx

     /usr/local/nginx/sbin/nginx  

   访问192.168.1.123 默认80端口

 

8.安装fastdfs-nginx-module

   减压 记住目录  unzip fastdfs-nginx-module-master.zip

9.进入nginx的安装包的源目录,然后编译和安装fastdfs-nginx-module

 注意需要关闭所有nginx进程  pkill -9 nginx

 进入nginx安装包解压目录

 ./configure --add-module=/home/sw/fastdfs-nginx-module-master/src(第8步目录)

 执行以下命令安装 make   make install

 配置nginx.conf cd /usr/local/nginx/conf/    编辑vi nginx.conf

   location /group1/M00 {

 

        root /home/yuqing/fastdfs/data;

 

         ngx_fastdfs_module;

 

       }

创建/M00软连接

  ln -s /home/yuqing/fastdfs/data /home/yuqing/fastdfs/data/M00

修改mod_fastdfs.conf

  更改tracker_serverIP

  更改store_path0这个要与storaged的配置一致

  复制  cp mod_fastdfs.conf /etc/fdfs/

  复制 cp /home/sw/FastDFS/conf/http.conf /etc/fdfs/

       cp /home/sw/FastDFS/conf/mime.types /etc/fdfs/

重新启动Nginx

   /usr/local/nginx/sbin/nginx -s stop

   /usr/local/nginx/sbin/nginx

再次访问(便成功访问了)

  http://192.168.1.123/group1/M00/00/00/wKgBe1q0lTmAVUsKAATdp5YKaPM492_big.jpg

相关安装包资料我已放在以下地址了,欢迎下载

https://download.csdn.net/download/notears0828/10329925


 

参考博客

   https://blog.csdn.net/jun2016425/article/details/53572088

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值