五.在各个存储节点安装nginx
1.上传 fastdfs-nginx-module_v1.16.tar.gz 到/usr/local/src,解压
2.修改 fastdfs-nginx-module 的 config 配置文件
将CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/" 修改为:CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
3.上传当前的稳定版本 nginx到/usr/local/src 目录
4.安装编译 nginx 所需的依赖包
yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl openssl-devel
5.编译安装 Nginx(添加 fastdfs-nginx-module 模块)
解压进入nginx目录
./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src
make && make install
6.复制 fastdfs-nginx-module 源码中的配置文件到/etc/fdfs 目录,并修改
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
vi /etc/fdfs/mod_fastdfs.conf
1)第一组 Storage 的 mod_fastdfs.conf 配置如下:
connect_timeout=10
base_path=/tmp
tracker_server=192.168.1.1:22122
tracker_server=192.168.1.2:22122
storage_server_port=23000
group_name=group1
url_have_group_name = true
store_path0=/fastdfs/storage
group_count = 2
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/fastdfs/storage
[group2]
group_name=group2
storage_server_port=23000
store_path_count=1
store_path0=/fastdfs/storage
(2)第一组 Storage 的 mod_fastdfs.conf 配置与第一组配置只有 group_name 不同: group_name=group2
7.复制 FastDFS 的部分配置文件到/etc/fdfs 目录
cd /usr/local/src/FastDFS/conf
cp http.conf mime.types /etc/fdfs/
8.在/fastdfs/storage 文件存储目录下创建软连接,将其链接到实际存放数据的目录
ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00
9.配置 Nginx
vi /usr/local/nginx/conf/nginx.conf
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8888;
server_name localhost;
location ~/group([0-9])/M00 {
#alias /fastdfs/storage/data;
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {root html;}} }
10.启动nginx
/usr/local/nginx/sbin/nginx
接下一篇fastdfs集群搭建3