1

i am running my personal website written with python on nginx with uwsgi. Since the site is very static i want to improve the performace by adding microcaching.

Both nginx and also uwsgi do offer caching.

Can somebody explain the difference between the two variants and give me an advice which one is the best?

Alexander
  • 235
  • 1
  • 3
  • 9

1 Answers1

2

Both references you provide are examples of nginx's caching functionality.

They both behave roughly the same but are used for different scenarios:

  1. The proxy_cache directives are used when the application (generally speaking the backend) is accessed through HTTP (i.e. when nginx serves as a [reverse] proxy for another web server).
  2. The uwsgi_cache directives are used when the application is hosted by an instance that uses the uwsgi protocol (for example the uWSGI application stack).

The directives available for each of the two methods behave very similar if not equally (this - of course - is intended behaviour).
nginx also offers similar functionality for e.g. FastCGI backends.

Since your setup uses uwsgi, you would rather use the corresponding uwsgi_cache directives.
Actually, you have to do so unless you want to introduce a second HTTP-based (web) server to serve your Python app behind your nginx instance.

Lukas
  • 1,004
  • 6
  • 14