Page 1 of 1

How to add cache control in the nginx-apache webserver

Posted: Sat Apr 14, 2018 5:14 pm
by qwerz
Hi there,

I am using a CDN which requires me to set a Max Age and "public" in the origin server which currently uses vestacp (Nginx+apache).

I tried settings this in the .htaccess:

Code: Select all

# One month for most static assets
<FilesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2628000, public"
</FilesMatch>
That does not work though. The header still says "cache-control: max-age=315360000"
Not sure where this 315360000 comes from. I assume vestaCP has it set somewhere in nginx or apache..

I tried searching in the vestaCP advanced server configuration for that number and 'cache control' as well. But couldnt find anything that sets that number.

Any tips on how to get this sorted? Maybe override it in some way by htaccess?

Thanks!

Re: How to add cache control in the nginx-apache webserver

Posted: Tue Apr 17, 2018 6:31 pm
by qwerz
This is really frustrating. Something within Vesta is overwriting the htaccess settings.

I didn't change anything after installing vestaCP. So either the basic nginx does this or apache.

Still couldn't find out what it is >:(

Re: How to add cache control in the nginx-apache webserver

Posted: Thu Apr 26, 2018 6:58 pm
by qwerz
qwerz wrote:
Tue Apr 17, 2018 6:31 pm
This is really frustrating. Something within Vesta is overwriting the htaccess settings.

I didn't change anything after installing vestaCP. So either the basic nginx does this or apache.

Still couldn't find out what it is >:(
It seems Apache or nginx does this automatically on VestaCP. Can someone confirm? and where to change that setting? Because it ignores htaccess for this matter on vesta standard.

Re: How to add cache control in the nginx-apache webserver

Posted: Wed May 02, 2018 7:24 pm
by noogen
The default setting in Vesta NGINX to expire: max - http://nginx.org/en/docs/http/ngx_http_ ... ml#expires
315360000 = 10 years per the documentation

You can override this in your panel config. Under Vesta - WEB configuration, look at the nginx proxy section. Remove all extension you do not want this in the Proxy Extensions section.

Re: How to add cache control in the nginx-apache webserver

Posted: Fri May 04, 2018 3:58 am
by petra
qwerz wrote:
Tue Apr 17, 2018 6:31 pm
This is really frustrating. gmail sign up Something within Vesta is overwriting the htaccess settings.

I didn't change anything after installing vestaCP. So either the basic nginx does this or apache.

Still couldn't find out what it is >:(
This is frustrating....