Offer

FastDFS-Nginx整合FastDFS

Nginx整合FastDFS

先看下访问效果:http://47.101.163.73/group1/M00/00/00/rBNNhF-ATU2AT30mAAAADdhtO1M790.txt

参考链接:https://www.cnblogs.com/mrhelloworld/p/fastdfs-nginx.html

Fastdfs-nginx-module环境配置(以下都是在/usr/local/src目录下)

#这个是部署好后上传的fastdfs-nginx-module  |  或者可以去https://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/下载
wget http://47.101.163.73/group1/M00/00/00/rBNNhF-ATp2AASYfAABEZhRCLAk.tar.gz
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

vim /etc/fdfs/mod_fastdfs.conf(修改内网IP)

# tracker 服务器的 IP 和端口
tracker_server = 内网ip:22122
# url 地址是否包含组名/卷名
url_have_group_name = true
# 数据组/卷对应的路径地址
store_path0 = /fastdfs/storage/store

#修改之前fastdfs的内容
cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/
cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/

安装Nginx:

#这两个选一个,一个是官网的,一个是我最后弄好之后上传到fastDFS的
wget -P /usr/local/src http://nginx.org/download/nginx-1.18.0.tar.gz # wget -P http://47.101.163.73/group1/M00/00/00/rBNNhF-ATaKAboBnAA_cqu4u5Qw.tar.gz

tar -zxvf /usr/local/src/nginx-1.18.0.tar.gz -C /usr/local/src
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl-devel

###下面步骤可能在./configure出错,ln -s /usr/include/fast* /usr/local/include/,重新编译一下软连接就行
# 切换至 nginx 的解压目录
cd /usr/local/src/nginx-1.18.0
# 创建 nginx 的安装目录
mkdir -p /usr/local/nginx
# 添加 fastdfs-nginx-module 模块,指定 nginx 的安装路径
./configure --add-module=/usr/local/src/fastdfs-nginx-module-master/src --prefix=/usr/local/nginx/
# 编译并安装
make && make install


vim /usr/local/nginx/conf/nginx.conf

#在location /下添加这条语句
location ~/group[0-9]/ {
    ngx_fastdfs_module;
}
#启动nginx
/usr/local/nginx/sbin/nginx
#然后按照之前上传文件到fastDFS就能访问到了

UTOOLS1602244841262.png

posted @ 2020-10-09 20:03  Empirefree  阅读(197)  评论(0编辑  收藏  举报