Linux Nginx FastDFS模块安装 Nginx与FastDFS整合


Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过两年半了。

1、下载 Nginx FastDFS 模块

http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz

文件我下载到了: /software/FastDFS/ 目录下

Nginx 安装参考:

注: 在第四步的时候: 改下编译参数:
./configure –prefix=/usr/local/nginx_fastdfs –with-pcre=/software/nginx/pcre-8.32 –add-module=/software/FastDFS/fastdfs-nginx-module/src

make
 make install

编译下文件
vim /etc/fdfs/mod_fastdfs.conf

# the base path to store log files
 base_path=/data1/fastdfs ====> 放置log的目录

# “host:port”, host can be hostname or ip address
 tracker_server=192.168.3.220:22122 ====> tracker server的ip和端口,此处可以写多个tracker server,每行一个

# the group name of storage server
 group_name=group1 ====> 此台storage server所属的服务器组名 可以不配置

# default value is false
 url_have_group_name = false #====> 在URL中包含group名称 group1/M00/xxx

# store_path#, based 0, if store_path0 not exists, it’s value is base_path
 # the paths must be exist
 store_path0=/data1/fastdfs #====> 放置文件的目录

store_path_count=3
 store_path0=/data1/fastdfs/store0
 store_path1=/data1/fastdfs/store1
 store_path2=/data1/fastdfs/store2

修改 模块 配置文件
vi /usr/local/nginx_fastdfs/conf/nginx.conf
 location /M00 {
 root /data1/fastdfs/store0/data;
 ngx_fastdfs_module;
 }

location /M01 {
 root /data1/fastdfs/store1/data;
 ngx_fastdfs_module;
 }
 location /M02 {
 root /data1/fastdfs/store2/data;
 ngx_fastdfs_module;
 }

启动nginx /usr/local/nginx_fastdfs/sbin/nginx
上传文件 用浏览器 访问 http://nginxip/M02/00/00/Cs8b8k-Ood2Id2KjAAAJ-dvLKCkAAAAAgAAChEAAAoR0374408 如果正确安装成功。

更多Nginx相关教程见以下内容

CentOS 6.2实战部署Nginx+MySQL+PHP

使用Nginx搭建WEB服务器

搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程

CentOS 6.3下Nginx性能调优

CentOS 6.3下配置Nginx加载ngx_pagespeed模块

CentOS 6.4安装配置Nginx+Pcre+php-fpm

Nginx安装配置使用详细笔记

Nginx日志过滤 使用ngx_log_if不记录特定日志

Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里

本文永久更新链接地址

相关内容