fastdfs使用nginx出现的问题

在配置FastDFS与Nginx时,遇到编译错误'fatal error: fdfs_define.h: No such file or directory'。解决方法是在/root/fastdfs-nginx-module/src/config文件中添加FASTDFS头文件路径,并重新编译安装。此外,Nginx配置中,当有多个group时,访问路径需包含group名称,如'/group1/M00/00/00/**'。参考文献包含了相关配置教程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        3.解决报错

        make的时候会报一下错误,

        root/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory

 #include "fdfs_define.h"

                        ^

compilation terminated.

make[1]: *** [objs/addon/src/ngx_http_fastdfs_module.o] Error 1

解决办法:

  vim /root/fastdfs-nginx-module/src/config

 

 CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"

 CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"

 重新编译,安装即可

-------------------------------


[root@fastdfs-storage ~] # vim /application/nginx/conf/nginx.conf
     user  root;    
     worker_processes  1;
     events {
        worker_connections  1024;
     }
     http {
         include       mime.types;
         default_type  application /octet-stream ;
         sendfile        on;
         keepalive_timeout  65;
         server {
             listen       8888;
             server_name  localhost;
             location ~ /group [0-9]/ {
                 ngx_fastdfs_module;
             }
             error_page   500 502 503 504   /50x .html;
             location =  /50x .html {
             root   html;
             }
         }
     }

说明: 

a、"user root"是解决下载操作时报404的问题

b、8888端口号与/etc/fdfs/storage.conf中的http.server_port=8888相对应

c、storage对应有多个group的情况下,访问路径带group名称,例如:/group1/M00/00/00/**,对应nginx配置:

    location ~/group[0-9]/ {
           ngx_fastdfs_module;
     }



参考文献

http://www.linuxidc.com/Linux/2015-11/125095.htm

http://blog.itpub.net/29254281/viewspace-1288761/

http://oldcat1981.blog.51cto.com/10670523/1766810

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值