unknown directive "ngx_fastdfs_module" 问题

工具 2019-05-07 1023 字 1252 浏览 点赞

今天给 nginx 组合 fastdfs-nginx-module ,起初是一步一步来的。

先是在 nginx 目录下配置 fastdfs-nginx-module 的路径:

./configure --add-module=[fastdfs-nginx-module 路径]/src


然后是给 nginx 目录下的 objs/Makefile 文件中增加头文件目录:

ALL_INCS = -I src/core \
    -I /usr/include/fastdfs \  # 增加的
    -I /usr/include/fastcommon \  # 增加的
    -I src/event \
    -I src/event/modules \

接着就是在 nginx 目录下 makemake install。无报错,一切正常。

然后是拷贝 nginx/conf/mime.typesfastdfs/conf/http.conffastdfs-nginx-module/src/mod_fastdfs.conf 这三个文件到 /etc/fdfs 目录下。根据实际情况修改 mod_fastdfs.conf 文件。

最后配置 nginx.conf 如下:

location /group1/M00 {
    root /opt/YouGuan/fastDFS/storage/data;
    ngx_fastdfs_module; 
}

但是,页面仍不能直接访问图片。nginx 的错误日志中一直报:2019/05/05 22:24:53 [emerg] 67870#0: unknown directive "ngx_fastdfs_module" in /usr/local/nginx/conf/nginx.conf:70 。试了很多方法都没解决。

结果却是:没有重启 nginx 。记住,一定要重启 nginx,命令:systemctl restart nginx 。如果只是重新加载 nginx.conf 文件(nginx -s reload)是不管用的,不要问我为什么知道!



本文由 Guan 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论