zoukankan      html  css  js  c++  java
  • Ubuntu16.04系统下FastDFS+Nginx安装配置

    一、FastDFS的安装(安装FastDFS前需要安装libevent和libfastcommon):

    1、安装libevent:

    下载libevent-2.0.22-stable.tar.gz

    下载地址:https://pan.baidu.com/s/1O6imihg2tE8D7zoMi8jlWw        提取码: 7e95 

    下载后解压缩    tar -zxvf libevent-2.0.22-stable.tar.gz

                              cd libevent-2.0.22-stable

                              ./configure

                              make

                              sudo make install

    2、安装libfastcommon:

    下载libfastcommon-master.zip

    下载地址:https://pan.baidu.com/s/1IAtqmtgztR3ppEIIlSi7kA              提取码: arvi 

    下载后解压缩    unzip libfastcommon-master.zip

                              cd libfastcommon-master

                              ./make.sh

                              sudo ./make.sh install

    3、安装FastDFS:

    下载FastDFS_v5.08.tar.gz

    下载地址:链接: https://pan.baidu.com/s/107hxJWxXkWF1rPOHIUCzWA          提取码: 6ng2 

    下载后解压缩    tar -zxvf FastDFS_v5.08.tar.gz

                              cd FastDFS

                              ./make.sh

                              sudo ./make.sh install

    二、配置FastDFS:

    1、创建文件存储目录:

          mkdir ~/data

          mkdir ~/data/fastdfs

    2、tracker配置:

          创建tracker目录:

          mkdir ~/data/fastdfs/tracker

          修改/etc/fdfs/tracker.conf配置文件

          cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

          vim /etc/fdfs/tracker.conf

           修改配置为:

           # the base path to store data and log files
                      base_path=/home/{user}/data/fastdfs/tracker

    3、storage配置:

          创建storage目录:

          mkdir ~/data/fastdfs/storage

          修改/etc/fdfs/storage.conf配置文件

          cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

          vim /etc/fdfs/storage.conf

           修改配置为:

           # the base path to store data and log files
                      base_path=/home/{user}/data/fastdfs/storage

           # store_path#, based 0, if store_path0 not exists, it's value is base_path
                      # the paths must be exist
                      store_path0=/home/{user}/data/fastdfs/storage

          # tracker_server can ocur more than once, and tracker_server format is
                     #  "host:port", host can be hostname or ip address
                     tracker_server=192.168.181.53:22122

    4、client配置:

         创建tracker目录:

          mkdir ~/data/fastdfs/client

          修改/etc/fdfs/tracker.conf配置文件

          cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf

          vim /etc/fdfs/client.conf

           修改配置为:

                      # the base path to store log files
                      base_path=/home/{netsin}/data/fastdfs/client

                      # tracker_server can ocur more than once, and tracker_server format is
                      #  "host:port", host can be hostname or ip address
                      tracker_server=192.168.181.53:22122

    三、启动和测试:

    1、启动服务:

         #启动tracker server

                    fdfs_trackerd /etc/fdfs/tracker.conf start

                    #启动storage server 

                    fdfs_storaged /etc/fdfs/storage.conf start

    2、上传测试:

        /usr/bin/fdfs_upload_file /etc/fdfs/client.conf ./db.sqlite3

        返回:group1/M00/00/00/wKi1NVyKBnCAQnsjAAAAAAAAAAA4572704

        返回以下ID号,说明文件上传成功。

    四、安装Nginx:

    1、安装fastdfs-nginx-module:

    下载fastdfs-nginx-module_v1.16.tar.gz

    下载地址:https://pan.baidu.com/s/11AEgSf1ZbSQGRaOBpTvqHQ              提取码: zpqa 

    下载后解压缩    tar -zxvf fastdfs-nginx-module_v1.16.tar.gz

           

    2、安装openssl:

    下载openssl-1.1.0j.tar.gz

    下载地址:链接: https://pan.baidu.com/s/1p341jCmAS_6z3JA_flrZyw              提取码: fn18

    下载后解压缩    tar -zxvf openssl-1.1.0j.tar.gz

    3、安装zlib:

    下载zlib-1.2.11.tar.gz

    下载地址:https://pan.baidu.com/s/1d6B13reZGMRB3BmKzExwfw                提取码: wiws 

    下载后解压缩    tar -zxvf zlib-1.2.11.tar.gz

                              cd zlib-1.2.11

                              ./configure

                              make

                              sudo make install

    4、安装pcre:

    下载pcre-8.35.tar.gz

    下载地址:https://pan.baidu.com/s/1oz9QH1slDEOHG1hyoxeSbw                    提取码: us29 

    下载后解压缩    tar -zxvf pcre-8.35.tar.gz

                              cd pcre-8.35

                              ./configure

                              make

                              sudo make install

    4、安装nginx:

    下载nginx-1.10.3.tar.gz

    下载地址:https://pan.baidu.com/s/1hhuJdjE_GX4OUzPHHTBQFw                   提取码: fztp 

    下载后解压缩    tar -zxvf nginx-1.10.3.tar.gz

                              cd nginx-1.10.3

                              ./configure --prefix=/usr/local/nginx --with-openssl=/home/{user}/Desktop/FastDFS/openssl-1.1.0j --with-pcre=/home/{user}/Desktop/FastDFS/pcre-8.35 --with-zlib=/home/{user}/Desktop/FastDFS/zlib-1.2.11 --add-module=/home/{user}/Desktop/FastDFS/fastdfs-nginx-module/src

                              make

                              sudo make install

    编译错误处理:https://www.cnblogs.com/wanghaiqi24/p/10031989.html

    5、配置Nginx:

    修改配置文件:

    sudo vim /usr/local/nginx/conf/nginx.conf

    添加一下内容:

               server{
                     listen 80;
                     server_name localhost;

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

    6、配置mod_fastdfs:

    复制配置文件:

    sudo cp ./fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf

    修改配置文件:

    # the base path to store log files
               base_path=/home/netsin/data/fastdfs/storage

    # FastDFS tracker_server can ocur more than once, and tracker_server format is
               #  "host:port", host can be hostname or ip address
               # valid only when load_fdfs_parameters_from_tracker is true
               tracker_server=192.168.181.53:22122

    # store_path#, based 0, if store_path0 not exists, it's value is base_path
               # the paths must be exist
               # must same as storage.conf
               store_path0=/home/netsin/data/fastdfs/storage

              复制这两个文件到fdfs配置文件,要不无法访问nginx

              cp ~/FastDFS/conf/http.conf /etc/fdfs/http.conf
              cp ~/FastDFS/conf/mime.types /etc/fdfs/mime.types

    7、启动Nginx:

                sudo /usr/local/nginx/sbin/nginx

                8、通过Nginx下载文件:

                wget http://192.168.181.53/group1/M00/00/00/wKi1NVyKJeKAU4puAAACGVfem5U8206.py

    原文:https://blog.csdn.net/mhdp820121/article/details/88547526

  • 相关阅读:
    494 Target Sum 目标和
    493 Reverse Pairs 翻转对
    492 Construct the Rectangle 构建矩形
    491 Increasing Subsequences 递增子序列
    488 Zuma Game 祖玛游戏
    486 Predict the Winner 预测赢家
    485 Max Consecutive Ones 最大连续1的个数
    483 Smallest Good Base
    Django Form组件
    Django Auth组件
  • 原文地址:https://www.cnblogs.com/bkylkh/p/10876431.html
Copyright © 2011-2022 走看看