S
S
sergeevpetro2018-07-23 00:37:08
Nginx
sergeevpetro, 2018-07-23 00:37:08

How to change max-age in cache-control?

Given:
+ Vesta CP
+ Nginx server
+ headers_module (shared) - checked via httpd -t -D DUMP_MODULES command
What you need:
Change max-age or even disable browser caching for one / several js files.
What I tried:
1) inserted into nginx.conf

server {
location ~* \.(?:css|js|gif|jpe?g|png)$ {
add_header Cache-Control "max-age=86400, public";
}
}

But when saving, it gives Error: nginx failed to start with new config. Strange, but in VestaCP there is no server { } structure in the nginx.conf file
2) in .htaccess I wrote

Header set Cache-Control "max-age=86400, public"

Without any effect.
3) in httpd.conf wrote in the block and outside it

Header set Cache-Control "max-age=86400, public"

Also to no avail.
Need help!

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