Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elcuervo/nginx_http_redis
Mirror from wiki.nginx.org
https://github.com/elcuervo/nginx_http_redis
Last synced: 3 months ago
JSON representation
Mirror from wiki.nginx.org
- Host: GitHub
- URL: https://github.com/elcuervo/nginx_http_redis
- Owner: elcuervo
- License: other
- Created: 2011-01-17T17:14:39.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-01-17T17:14:55.000Z (almost 14 years ago)
- Last Synced: 2023-04-10T15:48:41.425Z (almost 2 years ago)
- Language: C
- Homepage:
- Size: 80.1 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
nginx HTTP redis module
--Description:
--The nginx HTTP redis module for caching with redis,
http://code.google.com/p/redis/.The redis protocol
(http://code.google.com/p/redis/wiki/ProtocolSpecification)
not yet fully implemented, but GET and SELECT commands only.Installation:
--You'll need to re-compile Nginx from source to include this module.
Modify your compile of Nginx by adding the following directive
(modified to suit your path of course):./configure --add-module=/absolute/path/to/ngx_http_redis
make
make installUsage:
--Example 1.
http
{
...
server {
location / {
set $redis_key "$uri?$args";
redis_pass 127.0.0.1:6379;
error_page 404 502 504 = @fallback;
}location @fallback {
proxy_pass backed;
}
}
}Example 2.
Capture User-Agent from an HTTP header, query to redis database
for lookup appropriate backend.Eval module (http://www.grid.net.ru/nginx/eval.en.html) required.
http
{
...
upstream redis {
server 127.0.0.1:6379;
}server {
...
location / {eval_escalate on;
eval $answer {
set $redis_key "$http_user_agent";
redis_pass redis;
}proxy_pass $answer;
}
...
}
}Thanks to:
--Maxim Dounin
Vsevolod Stakhov
Ezra ZygmuntowiczSpecial thanks to:
--
Evan Miller for his "Guide To Nginx Module Development" and "Advanced Topics
In Nginx Module Development"
Valery Kholodkov for his "Nginx modules development"