G
G
grabbee2020-08-26 13:08:31
Nginx
grabbee, 2020-08-26 13:08:31

How to setup different cache for API with single index.php?

If I write fastcgi_cache_valid 30s; in

location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
          fastcgi_cache_lock on;
          fastcgi_cache phpcache;
          fastcgi_cache_valid 30s;


Then it will cache all requests for 30 seconds?

But for example, I need to cache the list of names at /api/names for a day.
How to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question