您的位置:首页 > 运维架构 > Nginx

CentOS nginx FastDFS 安装文档 详细步骤

2016-09-28 16:04 387 查看
一、安装编译环境
yum install gcc-c++
yum installopenssl-devel
yum install pcre-devel
yum install zlib-devel
二、安装FastDFS
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
tar -zxvfV1.0.7.tar.gz
cd libfastcommon-1.0.7
sh make.sh
sh make.sh install
ln -s/usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s/usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s/usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s/usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
tar –zxvf FastDFS_v5.05.tar.gz
cd FastDFS
修改TARGET_PREFIX=$DESTDIR/usr/local
vi make.sh
sh make.sh
sh meke.sh install
vi /etc/fdfs/tracker.conf
base_path=/data/fastdfs

修改文件地址
vi /etc/fdfs/storage.conf
base_path=/data/fastdfs
store_path0=/data/images
创建文件存储地址文件夹
mkdir /data/fastdfs
mkdir /data/images
mkdir /data/logs/
tracker_server=这里是tracker地址
启动tracker
/usr/local/bin/fdfs_trackerd/etc/fdfs/tracker.conf
启动storage
/usr/local/bin/fdfs_storaged/etc/fdfs/storage.conf
测试上传
/usr/bin/fdfs_test/etc/fdfs/client.conf /home/software/a.html
存储服务监听
/usr/local/bin/fdfs_monitor/etc/fdfs/storage.conf
netstat -unltp|grepfdfs
重启服务
/usr/local/bin/restart.sh/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/restart.sh/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf 
三、安装Nginx和fastdfs-nginx-module
上传nginx包
nginx-1.11.2.tar.gz
上传nginx-fastdfs-module包
fastdfs-nginx-module_v1.15.tar.gz
2.解压安装包:
tar -zxvf nginx-1.11.2.tar.gz
tar -zxvf fastdfs-nginx-module_v1.15.tar.gz
3.进入nginx安装包目录之行以下命令
./configure--prefix=/usr/local/nginx --add-module=fastdfs-nginx-module/src

4.安装Nginx:
make

make install
5.修改nginx.conf

vi /usr/local/nginx/conf/nginx.conf

80 server 添加如下:

 

location ~ /group[1-3]/M00{

           alias /data/images/data;

           ngx_fastdfs_module;

       }

 

存储文件添加软链接

ln -s /data/images/data//data/images/data/M00

 

复制配置文件到/etc/fdfs

cp fastdfs-nginx-module/src/mod_fastdfs.conf/etc/fdfs/

vi /etc/fdfs/mod_fastdfs.conf
base_path=/data/fastdfs
tracker_server=ip:22122
store_path0=/data/images
 
启动nginx
/usr/local/nginx/sbin/nginx –c /usr/local/nginx/conf/nginx.conf
 
修改客户端配置
vi /etc/fdfs/client.conf
 
测试上传

/usr/local/bin/fdfs_test/etc/fdfs/client.conf upload a.html

 

返回结果如下:表示成功

 

This is FastDFSclient test program v4.06

 

Copyright (C)2008, Happy Fish / YuQing

 

FastDFS may becopied only under the terms of the GNU General

Public License V3, which may be found inthe FastDFS source kit.

Please visitthe FastDFS Home Page http://www.csource.org/
for more detail.

 

[2016-09-06 17:20:37] DEBUG -base_path=/data/logs/fastdfs, connect_timeout=30, network_timeout=60,tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0,use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0,storage
server id count: 0

 

tracker_query_storage_store_list_without_group:

       server 1. group_name=, ip_addr=192.168.0.39, port=23000

 

group_name=group1, ip_addr=192.168.0.39,port=23000

storage_upload_by_filename

group_name=group1,remote_filename=M00/00/00/wKgAJ1fOimWAR3vOAAAABRsI9QY72.html

source ip address: 192.168.0.39

file timestamp=2016-09-06 17:20:37

file size=5

file crc32=453571846

file url:http://192.168.0.39:8080/group1/M00/00/00/wKgAJ1fOimWAR3vOAAAABRsI9QY72.html

storage_upload_slave_by_filename

group_name=group1,remote_filename=M00/00/00/wKgAJ1fOimWAR3vOAAAABRsI9QY72_big.html

source ip address: 192.168.0.39

file timestamp=2016-09-06 17:20:37

file size=5

file crc32=453571846

file url:http://192.168.0.39:8080/group1/M00/00/00/wKgAJ1fOimWAR3vOAAAABRsI9QY72_big.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  centos nginx fastdfs