fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf“

2021/12/4 7:16:39

本文主要是介绍fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf“,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

fastdfs-nginx-module-master/src/common.c, line: 163, load conf file "/etc/fdfs/mod_fastdfs.conf"

      • 介绍
      • 问题说明
      • 报错原因
      • 解决方法
      • 重新编译nginx
      • 重启nginx

介绍


在配置fastdfs-nginx-module时,nginx启动8888端口,访问http://localhost:8888/group1/M00/00/00/CgOYSGGoR5qASNqzAANi9H7oGe4006.jpg 时无响应,查看nginx的error.log日志,发现报错 fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf” fail, ret code: 2

2021-11-30 17:13:01] ERROR - file: shared_func.c, line: 1163, file /etc/fdfs/mod_fastdfs.conf not exist
[2021-11-30 17:13:01] ERROR - file: ../fastdfs-nginx-module-master/src/common.c, line: 163, load conf file "/etc/fdfs/mod_fastdfs.conf" fail, ret code: 2
[2021-11-30 17:13:01] INFO - file: ini_file_reader.c, line: 1349, func: checkInitDynamicContentArray, init_pthread_lock
[2021-11-30 17:13:01] INFO - file: ini_file_reader.c, line: 1384, func: checkAllocDynamicContentArray, alloc count: 8
[2021-11-30 17:13:01] ERROR - file: shared_func.c, line: 1163, file /etc/fdfs/mod_fastdfs.conf not exist
[2021-11-30 17:13:01] ERROR - file: ../fastdfs-nginx-module-master/src/common.c, line: 163, load conf file "/etc/fdfs/mod_fastdfs.conf" fail, ret code: 2
2021/11/30 17:13:01 [alert] 128284#0: worker process 128288 exited with fatal code 2 and cannot be respawned
2021/11/30 17:13:01 [alert] 128284#0: worker process 128286 exited with fatal code 2 and cannot be respawned

问题说明


fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf” fail, ret code: 2
看内容就知道加载配置文件 /etc/fdfs/mod_fastdfs.conf 失败,出现这个报错的大概原因就是 /etc/fdfs 下面没有这个配置文件

报错原因


由于自己安装fastdfs时修改了安装路径/data/fdfs/,没有生成 /etc/dfs目录

解决方法


修改 fastdfs-nginx-module-master/src/config
把 DFDFS_MOD_CONF_FILENAME 的路径改成自定义的目录就可以了
我这里 改成了/data/fdfs/etc/fdfs/mod_fastdfs.conf,一定要先把 mod_fastdfs.conf 复制过去

vim fastdfs-nginx-module-master/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='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/data/fdfs/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='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/data/fdfs/etc/fdfs/mod_fastdfs.conf\"'"
fi

重新编译nginx


./configure --prefix=/data/fdfsnginx --add-module=../fastdfs-nginx-module/src
make
make install

重启nginx


/data/fdfsnginx/sbin/nginx -c /data/fdfsnginx/conf/nginx.conf -s reload

CSDN_码404:fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf”
https://www.code404.icu/1465.html



这篇关于fastdfs-nginx-module-master/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf“的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程