Last active
May 8, 2018 06:18
-
-
Save douglasmiranda/01b9a5dedfc249ccabbc4c9878299863 to your computer and use it in GitHub Desktop.
Nginx Microcaching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
# In Django you can tell the Nginx to not cache with: | |
# https://docs.djangoproject.com/en/2.0/topics/http/decorators/#module-django.views.decorators.cache | |
# Microcache - Want 150 requests/sec to become 1200? | |
# | |
# https://www.nginx.com/blog/benefits-of-microcaching-nginx/ | |
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache | |
proxy_cache_path /tmp/cache keys_zone=cache:10m max_size=10g levels=1:2 inactive=600s max_size=100m; | |
server { | |
# ... | |
# Microcache | |
proxy_cache cache; | |
proxy_cache_lock on; | |
proxy_cache_valid 200 1s; | |
proxy_cache_use_stale updating; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment