1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grav_ynh.git synced 2024-09-03 19:16:01 +02:00

Update NGINX cache headers for assets

This commit is contained in:
tituspijean 2021-07-08 22:11:22 +02:00
parent bd64ae9bd9
commit 03268a3228

View file

@ -20,14 +20,6 @@ location __PATH__/ {
more_set_headers "X-Download-Options: noopen"; more_set_headers "X-Download-Options: noopen";
more_set_headers "X-Permitted-Cross-Domain-Policies: none"; more_set_headers "X-Permitted-Cross-Domain-Policies: none";
location ~* \.(jpg|jpeg|gif|css|png|js|ico|swf|mp3|pdf)$ {
# Le contenu statique, est signalé au navigateur comme étant
# à garder en cache une semaine. Si il y a un proxy sur la
# route, celui-ci est autorisé à faire une copie et à la
# cacher.
expires 1w;
more_set_headers "Cache-Control: public";
}
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
@ -40,6 +32,27 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
more_set_headers "Vary: Accept-Encoding";
log_not_found off;
}
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ {
access_log off;
expires 30d;
more_set_headers "Cache-Control: public";
## No need to bleed constant updates. Send the all shebang in one fell swoop.
tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
## Begin - Security ## Begin - Security
# deny all direct access for these folders # deny all direct access for these folders
location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; } location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; }