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
在server 里面添加以下内容
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文件配置一致)
最后启动Nginx上传验证
两台服务器可以把tracker和storage分开 nginx和storage一台或者都安装分成两个组group
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。