1. 压缩包版本
fastdfs-6.01.tar.gz
fastdfs-nginx-module-1.21.tar.gz
libfastcommon-1.0.41.tar.gz
nginx-1.16.1.tar.gz
pcre-8.43.tar.gz
zlib-1.2.11.tar.gz
注意:版本匹配很重要,否则会出现编译中找不到变量的情况
2. 安装zlib, pcre
(1)解压包
(2)./configure
(3)make && make install
3. 安装 fastcommon
(1)./make.sh
(2)./make.sh install
4. 安装fastdsf
(1)./make.sh
(2)./make.sh install
5. 安装nginx
(1)./configure --add-module=/root/fastfds/fastdfs-nginx-module-1.21/src/ --with-pcre=/root/fastfds/pcre-8.43/ --with-zlib=/root/fastfds/zlib-1.2.11/
(2)make && make install
6. 遇到的问题
(1)找不到logger:这是因为fastcommon没装好
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../common/fdfs_global.o ../common/fdfs_global.c -I../common -I/usr/include/fastcommon
../common/fdfs_global.c:20:20: fatal error: logger.h: No such file or directory
#include "logger.h"
(2)找不到pcre/zlib库
(3)
/usr/include/fastdfs/fdfs_define.h:15:27: fatal error: common_define.h: No such file or directory
#include "common_define.h"
解决方案:编辑 fastdfs-nginx-module-1.21/src/config 文件
ngx_addon_name=ngx_http_fastdfs_module
if test -n "${ngx_module_link}"; then
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
ngx_module_libs="-lfastcommon -lfdfsclient"
ngx_module_srcs="$ngx_addon_dir/ngx_http_fastdfs_module.c"
ngx_module_deps=
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='2561024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
. auto/module
else
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='2561024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
fi
(4)一系列fastdfs-nginx-module的源码编译错误(主要集中在common.c),这主要是安装的各个模块的版本不匹配 问题