原文地址:http://www.grid.net.ru/nginx/mogilefs.en.html (在墙外)
Nginx mogilefs module (v 1.0.3)
|
rus eng |
MogileFS client for nginx web server.
Description
The module queries MogileFS tracker specified by mogilefs_tracker directive and uses first path returned by tracker to fetch requested file. The file key is specified by mogilefs_pass directive. If no domain or no file with specified key is found by tracker "404 Not found" status is retuned. If file is found but zero paths are returned by tracker "503 Service unavailable" status is retuned. If tracker has returned successful response the modules tries to fetch file using path with the greatest priority.
Configuration directives
syntax: mogilefs_pass [<key>] {<fetch block>}
default: none
severity: mandatory
context: server, location, limit_except
Specifies key of the file to query from MogileFS tracker. The key can contain any variables. If key is omitted, the part of request URI will be uses as key, which remains after stripping the name of mathced location.
location /download/ {
mogilefs_pass {
[...]
}
}
In this example if request URI is /download/example.jpg, the tracker will be queried for file with the key example.jpg.
The fetch block contains configuration which will be used to fetch file from storage node. In this block it is necessary to use proxy_pass directive with $mogilefs_path as an argument. Example:
mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
The variable $mogilefs_path contains absolute URL to the file on storage node. The fetch block creates a hidden internal location with the name /mogilefs_fetch_XXXXXXXX, where redirected will be performed after successful tracker response.
syntax: mogilefs_methods <[[method 1] method 2 ... ]>
default: GET
severity: optional
context: main, server, location
Specifies which methods will be allowed to access MogileFS. GET retrieves a resource from MogileFS, PUT creates or replaces, DELETE deletes a resource in MogileFS.
syntax: mogilefs_domain <domain>
default: default
severity: optional
context: main, server, location
Specifies the name of MogileFS domain to query. The specification may contain variables.
syntax: mogilefs_class <class0> [ <class1> [ ... ] ]
default: N/A
severity: optional
context: main, server, location
This directive specifies what to use as "class" parameter when making a request to tracker. The arguments of this directives will be evaluated and first non-empty value will be used as class. Arguments can contain variables.
syntax: mogilefs_tracker <IP|IP:port|upstream>
default: none
severity: mandatory
context: main, server, location
Specifies address of MogileFS tracker to query.
syntax: mogilefs_noverify <on/off>
default: off
severity: optional
context: main, server, location
Enables sending of noverify argument to MogileFS.
syntax: mogilefs_connect_timeout <time>
default: 60s
severity: optional
context: main, server, location
Specifies a timeout to be used to connect to mogilefs tracker. Could not be longer than 75 seconds.
syntax: mogilefs_send_timeout <time>
default: 60s
severity: optional
context: main, server, location
Specifies a timeout to be used to send data to mogilefs tracker. If no data will be received by mogilefs tracker during this time interval, nginx will close the connection.
syntax: mogilefs_read_timeout <time>
default: 60s
severity: optional
context: main, server, location
Specifies a timeout to be used to receive data from mogilefs tracker. If no data will be send by mogilefs tracker during this time interval, nginx will close the connection.
Example configuration
error_log logs/error.log notice;
working_directory /usr/local/nginx;
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
#
# This location could be used to retrieve files from MogileFS.
# It is publicly available.
#
location /download/ {
#
# Query tracker at 192.168.2.2 for a file with the key
# equal to remaining part of request URI
#
mogilefs_tracker 192.168.2.2;
mogilefs_domain example_domain;
mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
}
#
# This location could be used to store or delete files in MogileFS.
# It may be configured to be accessable only from local network.
#
location /upload/ {
allow 192.168.2.0/24;
deny all;
mogilefs_tracker 192.168.2.2;
mogilefs_domain example_domain;
mogilefs_methods PUT DELETE;
mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
}
}
}
Requirements
nginx 0.7.1 or above is required to compile this module.
Download
Latest version 1.0.3:
or go to download area
Browse repository
http://github.com/vkholodkov/nginx-mogilefs-module/tree/master
How to use
Download sources from one of the links above. Unpack the archive:
tar xvzf nginx_mogilefs_module-1.0.3.tar.gz
Configure nginx with additional module:
cd <path to nginx sources>
./configure --add-module=<path to mogilefs module sources>
make
make install
Nginx
nginx -- is a web-server, developed by Igor Sysoev.
Licence
The above-described module is an addition to nginx web-server, nevertheless they are independent products. The licence of above-described module is BSD You should have received a copy of license along with the source code. By using the materials from this site you automatically agree to the terms and conditions of this license. If you don't agree to the terms and conditions of this license, you must immediately remove from your computer all materials downloaded from this site.
Contact author
Valery Kholodkov valery+nginx@grid.net.ru
Please use address extension while composing an Email to me.
Copyright (C) 2009 Valery Kholodkov
分享到:
相关推荐
fastdfs-nginx-module_v1.16.tar.gz源码包,nginx支持fastdgs的插件
亲测可用,一定要fdfs对应版本
"(五)prometheus 监控 nginx 服务"所需软件包其中之一:nginx-module-vts.tar.gz,大胆放心使用,不需要积分,只求浏览博客时留下您的评论和点赞,谢谢!
亲测可用,一定要对应版本
headers-more-nginx-module-0.34
fastdfs-nginx-module_master.zip正常
最新版linux fastdfs-nginx-module-1.22.tar.gz
解压之后安装如下:mv nginx-module-vts-0.1.18 /usr/local/ yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel cd /usr/local/nginx/nginx-1.13.7 ./configure --add-module=/...
fastdfs分布式文件系统搭建需要的插件,该插件用于编译nginx的安装,nginx添加的一个模块,用于http访问fastdfs资源。
FastDFS整合Nginx的模块压缩包。网上好像不好找,这里放一个吧,文件压缩了,下载之后解压即可,不要直接用linux解压命令解压。
(注意注意,里面有个文件libfastcommon... fastdfs-nginx-module_v1.16.tar.gz FastDFS_v5.05.tar.gz libevent-2.0.22-stable.tar.gz libfastcommon_v1.01.tar.gz nginx-1.6.3.tar.gz ngx_cache_purge-2.3.tar.gz
headers-more-nginx-module-0.30.tar.gz
lua-nginx-module-0.10.13
FastDFS_v5.05+fastdfs-nginx-module_v1.16+libfastcommonV1.0.7安装包及其依赖包
FastDFS 5.10 对应的 nginx 模块 V1.19。如果是FastDFS 5.12则要对应fastdfs-nginx-module-v1.20。内含三个源码,编译即可用
nginx扩展工具,nginx的headers_more模块用于 添加、修改或清除 请求/响应头,该模块不是nginx自带的,默认不包含该模块,需要另外安装。幸运的是openresty默认包含了该模块,可以直接使用。 该模块主要有4个指令...
fastdfs-nginx-module_v1.15.tar.gz