Nginx static cache configuration selection

choose that configuration for static files:

 location ~ .*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$ {
   
    expires 6h; -sharp
 
    }

and this configuration

 location ~ .*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$
    {
    proxy_pass http://app;
    expires 6h; 
    proxy_cache tem;

    proxy_cache_valid 200 1h;-sharp2001
    proxy_cache_valid 301 1d;-sharp301
    proxy_cache_valid any 1m;-sharp
    }

which configuration should I use? For dynamic requests, is it necessary to use the proxy_cache module to maintain direct access to the cache for a period of time?

Jul.09,2021

you give a static configuration and a proxy cache configuration and ask which configuration should be used. Isn't this supposed to ask you, so how is your site configured? Is it a static station or an agent to the back end?

Menu