fastfdfs搭配nginx

fastfdfs搭配nginx


  • 下载fastdfs-nginx-module 模块
    • wget https://github.com/happyfish100/fastdfs-nginx-module/archive/5e5f3566bbfa57418b5506aaefbe107a42c9fcb1.zip
    • unzip 5e5f3566bbfa57418b5506aaefbe107a42c9fcb1.zip
    • mv fastdfs-nginx-module-5e5f3566bbfa57418b5506aaefbe107a42c9fcb1  fastdfs-nginx-module-master
  • 下载nginx
    • 安装依赖
      • sudo apt-get install build-essential
      • sudo apt-get install libtool
      • sudo apt-get update
      • sudo apt-get install libpcre3 libpcre3-dev
      • sudo apt-get install zlib1g-dev
      • sudo apt-get install openssl
    • wget -c https://nginx.org/download/nginx-1.12.1.tar.gz
    • tar  -zxvf  nginx-1.12.1.tar.gz
    • cd nginx-1.12.1
    • ./configure --add-module=../fastdfs-nginx-module-master/src
    • make  &&  make  install
  • 复制 fastdfs-nginx-module 源码中的配置文件到/etc/fdfs 目录, 并修改
    • cp mod_fastdfs.conf /etc/fdfs/
    • vim  /etc/fdfs/mod_fastdfs.conf
    •  1 # 连接超时时间
       2 connect_timeout=10
       3 
       4 # Tracker Server
       5 tracker_server=Tracker Server的ip和端口号
       6 
       7 # StorageServer 默认端口
       8 storage_server_port=23000
       9 
      10 # 如果文件ID的uri中包含/group**,则要设置为true
      11 url_have_group_name = true
      12 
      13 # Storage 配置的store_path0路径,必须和storage.conf中的一致
      14 store_path0= Storage 配置的store_path0路径,必须和storage.conf中的一致
  •  进入fast_dfs安装包里的conf
    • cp anti-steal.jpg http.conf mime.types /etc/fdfs/
  • 配置nginx.conf
    • 找到nginx.conf
    • 加入这一行,启动nginx

    • /usr/local/nginx/sbin/nginx
  • 上传图片
    • fdfs_upload_file /etc/fdfs/client.conf 856154-20171011135658074-1715166829.png 
    • 打开浏览器访问
    • 完成

猜你喜欢

转载自www.cnblogs.com/ivy-blogs/p/11237118.html