Fastdfs+Nginx配置操作
单台配置
安装包下载:
wget https://github.com/happyfish200/libfastcommon/archive/V1.0.7.tar.gz
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-Nginx-module_v1.16.tar.gz
wget https://github.com/happyfish200/fastdfs/archive/V5.05.tar.gz
wget http://Nginx.org/download/Nginx-1.8.0.tar.gz
(备注:centos7里面Nginx的依赖包是最新的可以yum直接下载安装:yum install zlib* pcre* -y)
1.libfastcommon安装;
mkdir -pv /usr/fastdfs
tar -zxvf V1.0.7.tar.gz -C /usr/fastdfs/
cd /usr/fastdfs/libfastcommon-1.0.7
./make.sh
./make.sh install
2.安装Fastdfs;
tar -zxvf V5.05.tar.gz -C /usr/fastdfs/
cd /usr/fastdfs/fastdfs-5.05
./make.sh
./make.sh install
3.配置tracker和storage
cp conf/* /etc/fdfs/
(备注:FastDFS启动文件默认在/usr/bin/,配置文件在/etc/fdfs下)
mkdir -pv /data/fastdfs/tracker
mkdir -pv /data/fastdfs/storage
(备注:以上创建的是存放目录)
cd /etc/fdfs
vim tracker.conf
暂时修改下面一项即可
base_path=/data/fastdfs/tracker
vim storage.conf
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=本地IP地址:22122
http.server_port=8888
4.关闭防火墙,启动tracker和storage
systemctl stop firewalld.service
/usr/bin/fdfs_tracker /etc/fdfs/tracker start
/usr/bin/fdfs_storage /etc/fdfs/storage start
5.验证是否启动
ps -ef | grep fdfs
6.安装fastdfs-Nginx-module
tar -zxvf fastdfs-Nginx-module_v1.16.tar.gz -C /usr/local/
cd /usr/local/fastdfs-Nginx-module/src
vim config
去掉local目录层
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
cp mod_fastdfs.conf /etc/fdfs
vim /etc/fdfs/mod_fastdfs.conf
connect_timeout=10
tracker_server=本地IP地址:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage
7.装Nginx
cd
tar -zxvf Nginx-1.8.0.tar.gz
cd Nginx-1.8.0/
./configure --prefix=/usr/local/Nginx --add-module=/usr/local/fastdfs-Nginx-module/src/
make
make install
vim /usr/local/Nginx/conf/Nginx.conf
location ~/group1/M00{
root /data/fastdfs/storage/data;
ngx_fastdfs_module;
}
做个软连接ln -s /data/fastdfs/storage/data //data/fastdfs/storage/data/M00
监听端口:
listen 8888
(备注:Nginx里的端口要和配置FastDFS存储中的storage.conf文件配置一致)
两台服务器可以把tracker和storage分开 Nginx和storage一台或者都安装分成两个组group
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。