centos7安装配置FastDFS

1.环境准备

准备两台机器,分别安装fastdfs的tracker和storage

yum install -y gcc gcc-c++
yum -y install libevent

安装libfatscommon函数库

#解压
tar -zxvf libfastcommon-1.0.42.tar.gz
#编译安装
./make.sh
./make.sh install

安装fastdfs主程序

#解压
tar -zxvf fastdfs-6.04.tar.gz
#编译安装
./make.sh
./make.sh install  

拷贝配置文件

cp fastdfs-6.04/conf/* /etc/fdfs/

2.配置tracker

进入/etc/fdfs目录,修改tracker.conf

#配置tracker工作目录
base_path=/usr/local/fastdfs/tracker
#建立工作目录文件夹
mkdir /usr/local/fastdfs/tracker -p
#启动tracker服务
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

3.配置storage

进入/etc/fdfs目录,修改storage.conf

# 配置组名
group_name=mygroup
# 配置storage的工作空间
base_path=/usr/local/fastdfs/storage
# 配置storage的存储空间
store_path0=/usr/local/fastdfs/storage
# 第2步tracker的地址和端口号
tracker_server=192.168.199.131:22122

# nginx映射的对外服务端口号
http.server_port=8888
#建立工作目录文件夹
mkdir /usr/local/fastdfs/storage -p
#启动storage服务
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf

修改client.conf

#工作目录
base_path=/usr/local/fastdfs/client
#tracker服务
tracker_server=192.168.199.131:22122
#建立工作目录
mkdir /usr/local/fastdfs/client

测试图片上传

/usr/bin/fdfs_test /etc/fdfs/client.conf upload ./test.png

安装nginx(与storage安装在同一台服务器),提供文件访问

安装nginx,nginx安装参考
安装nginx的fastdfs模块

#解压
tar -zxvf fastdfs-nginx-module-1.22.tar.gz
#拷贝配置文件
cp mod_fastdfs.conf /etc/fdfs

修改ngx_module_incs和CORE_INCS路径
在这里插入图片描述
将模块加入nginx

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--add-module=/home/software/fastdfs-nginx-module-1.22/src

#nginx添加模块之后要重新编译和安装
make
make install

修改/etc/fdfs/mod_fastdfs.conf文件

#配置工作空间
base_path=/usr/local/fastdfs/tmp
#配置tracker服务
tracker_server=192.168.199.131:22122
#配置组名
group_name=mygroup
#访问路径是否包含组名
url_have_group_name = true
#配置存储空间
store_path0=/usr/local/fastdfs/storage
#建立工作空间
mkdir /usr/local/fastdfs/tmp

修改nginx配置文件

server {
	#访问端口号,与storage.conf中的http.server_port保持一致
    listen       8888;
    server_name  localhost;

    location /mygroup/M00 {
            ngx_fastdfs_module;
    }

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值