4、修改配置文件
1)nginx.conf
在server中增加配置:
访问路径不带group名(storage只有一个group的情况),如/M00/00/00/xxx:
location /M00 {
ngx_fastdfs_module;
}
访问路径带group名(storage对应有多个group的情况),如/group1/M00/00/00/xxx:
location ~ /group([0-9])/M00 {
ngx_fastdfs_module;
}
2)mod_fastdfs.conf
将fastdfs-nginx-module_v1.15解压目录fastdfs-nginx-module/src下的mod_fastdfs.conf复制到-DFDFS_MOD_CONF_FILENAME配置的目录下,如/etc/fdfs/。
修改配置:
tracker_server=192.168.1.241:22122 -- tracker server的ip和端口,此处可以写多个tracker server,每行一个
url_have_group_name = true --访问路径带group时为true否则为false,多个group的情况下,必须为true,为false时,group_count必须为0
storage只有一个group的情况:
group=group1 --storage对应的group
store_path0=/webapp/fastdfs/storage --storage存储路径
group_count = 0
storage对应有多个group的情况:
url_have_group_name = true --必须设置为true才能支持多个group
group_count = 2 --storage的group个数
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage
[group2]
group_name=group2
storage_server_port=23000
store_path_count=1
store_path0=/webapp/fastdfs/storage2
5、重启Nginx,验证。
相关阅读:
CentOS 6.2实战部署Nginx+MySQL+PHP http://www.linuxidc.com/Linux/2013-09/90020.htm
使用Nginx搭建WEB服务器 http://www.linuxidc.com/Linux/2013-09/89768.htm
搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm
CentOS 6.3下Nginx性能调优 http://www.linuxidc.com/Linux/2013-09/89656.htm
CentOS 6.3下配置Nginx加载ngx_pagespeed模块 http://www.linuxidc.com/Linux/2013-09/89657.htm
CentOS 6.4安装配置Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
