Storage安装fastdfs-nginx-module模块,通过url访问
A> nginx安装,参考 http://www.linuxidc.com/Linux/2013-10/90869.htm
B> 安装fastdfs-nginx-module插件
#worksrc;
wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz;
tar -zxvf fastdfs-nginx-module_v1.15.tar.gz;
#修改插件配置文件
vim /usr/local/src/fastdfs-nginx-module/src/config
ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/local/fastdfs/include/fastdfs /usr/local/fastdfs/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/local/fastdfs/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -
DFDFS_MOD_CONF_FILENAME='\"/usr/local/fastdfs/conf/mod_fastdfs.conf\"'"
#复制mod_fastdfs.conf到/usr/local/fastdfs/conf/目录下
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /usr/local/fastdfs/conf/
上面编译时使用的动态链接库
#将/usr/local/fastdfs/lib 加入系统文件/etc/ld.so.conf中
vim /etc/ld.so.conf
/usr/local/fastdfs/lib
#更新库文件缓存ld.so.cache
/sbin/ldconfig
C> 编译fastdfs-nginx-module模块
cd nginx-1.1.19/;
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
make; make install;
修改mod_fastdfs.conf配置
vim /usr/local/fastdfs/conf/mod_fastdfs.conf
# the base path to store log files
base_path=/tmp
# if load FastDFS parameters from tracker server
# since V1.12
# default value is false
load_fdfs_parameters_from_tracker=true
# 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.25.11:22122
# the port of the local storage server
# the default value is 23000
storage_server_port=23000
# the group name of the local storage server
group_name=group2
# if the url / uri including the group name
# set to false when uri like /M00/00/00/xxx
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
# default value is false
url_have_group_name = true
# path(disk or mount point) count, default value is 1
# must same as storage.conf
store_path_count=1
# 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/fastdfs/storage
# set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
# empty for output to stderr (apache and nginx error_log file)
log_filename=/home/www/logs/mod_fastdfs.log
nginx配置简洁版本
#vim /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes 2;
error_log /home/www/logs/error.log notice;
pid /home/www/logs/nginx.pid;
worker_rlimit_nofile 5120;
events {
use epoll;
worker_connections 5120;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
server {
listen 80;
server_name localhost;
location /group2/M00 {
alias /home/fastdfs/storage/data;
ngx_fastdfs_module;
}
}
}
#启动nginx
#脚本在《详细nginx安装步骤》
sernginx start
安装Storage Server -192.168.127.14
参考192.168.127.13安装,不同点就是192.168.127.13是group2的源服务,storage.conf配置不同,需要注意
