Skip to content

Instantly share code, notes, and snippets.

@markselby
Created October 28, 2013 02:58
Show Gist options
  • Save markselby/7190829 to your computer and use it in GitHub Desktop.
Save markselby/7190829 to your computer and use it in GitHub Desktop.
Nginx config for using LUA / Redis cache.
location / {
try_files $uri @redis_cache;
add_header Source Files; # Handy for development
}
location @redis_cache {
# Make sure this path is correct
# Run "nginx -V" from the command prompt and look for --prefix=/path/to/somewhere
# and place redis.lua there, or use an absolute path as shown below
content_by_lua_file /path/to/your/config/redis.lua;
error_page 404 503 = @writebox_upstream;
add_header Source Redis; # Handy for development
}
location @writebox_upstream {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Remote-IP $remote_addr;
add_header Source Upstream; # Handy for development
# ...... etc etc ........
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment