在nginx和fastdfs配合使用

来源:互联网 发布:手机幻灯片制作软件 编辑:程序博客网 时间:2024/06/06 09:05

nginx有一个插件叫fastdfs-nginx-module_v1.16.tar.gz

1.解压安装

2.解压后的

fastdfs-nginx-module/src/config 文件内容需要修改

一共有三处 /usr/后面的local删除掉,删之前可以先进去目录看看有没有此文件夹,视版本而定

LES="$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 -L/usr/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"


3.

1、对nginx重新config

./configure \

--prefix=/usr/local/nginx \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/temp/nginx/client \

--http-proxy-temp-path=/var/temp/nginx/proxy \

--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \

--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \

--http-scgi-temp-path=/var/temp/nginx/scgi \

--add-module=/路径下的/xxxx/xxx/xxx/xxxxxfastdfs-nginx-module/src


1、make

2、make install

3、把/     路径下的 /xxxx/xxxxx/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:

store_path0=/home/yuqing/fastdfs#文件保存路径

base_path=/x/xx/x/x/x/x #需要存在一个真实路径

tracker_server=192.168.158.130:22122   #  tracker服务器地址和端口

url_have_group_name=true #由默认的false改成true


nginx的配置文件中添加一个Server

#http://192.168.158.130/group1/M00/00/00/wKiegldP8u6AJ5u7AADtVgGdiYo511.jpg
server {
        listen       80;
        server_name  192.168.158.130; 这里需要是本机(虚拟机)的IP地址
        location /group1/M00/{
         root /home/yuqing/fastdfs/data/;
                ngx_fastdfs_module;


启动NGINX访问生成图片的IP地址 OK.


0 0