I have a django project that I'd like to setup caching for. I want my caching system to cache everything after nginx.

I found varnish but it has a problem - I use unix socket for communications between gunicorn and Nginx, but varnish doesn't support unix sockets. Is there a way or other caching tool to use?

I also using django caching but I need a cache before gunicorn and after nginx. What is the best method?


You can look at the gunicorn cache


It works like the uwsgi cache worker, cache every request you configured between gunicorn and your application.


Your question is rather unclear and doesn't give enough information to give an authoritative answer. I've also made your question more readable by forming it into sentences. I'll give you my initial thoughts and may change them if you provide more information.

Your requirements of "Before Gunicorn and after Nginx" is unclear - what exactly are you thinking you're going to cache between them, and now? You can cache in Nginx, or you can cache in the PHP behind Nginx, but typically not between them.

Nginx page caching is typically very effective. It's only useful where the user isn't logged in, because clearly you don't want to share personalised pages. If you search for "Nginx Page Caching" you'll find useful information. I have a tutorial about Nginx/Wordpress, you can adapt the configurations for your needs.

If you can clarify your setup, needs, and use cases I may be able to refine this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.