# /**
# * @version 2.4
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
# * @copyright Copyright (c) 2014 - 2024 Kodeka OÜ. All rights reserved.
# * @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
# */
# === STATIC ASSET CACHING ===
# Proxy Cache Settings for static files ONLY.
# Nginx can cache static files and directly serve them without issuing calls to
# Apache on every static file request.
#
# By default, Engintron will set a 10s (s for seconds) cache time for static files.
#
# To increase, simply adjust the value for "proxy_cache_valid". Just keep in
# mind that when editing a file and unless you use cache busting techniques,
# Nginx will serve that file's cached copy, until it expires in Nginx cache pool.
#
# Respects the different "Expires" values set per file type in "common_http.conf"
# for client-side caching.
#
# Every other header is ignored, stripped or reset from the request to
# maximize caching.
#
# Static asset caching is turned off when certain criteria are met, e.g. when a site
# manager logs into WordPress' backend.
# Admin sections for CMSs
if ($request_uri ~* "(/administrator|/wp-admin|/wp-login.php)") {
set $CACHE_BYPASS_FOR_STATIC 1;
}
# Proxy cache settings
proxy_no_cache $CACHE_BYPASS_FOR_STATIC;
proxy_cache_bypass $CACHE_BYPASS_FOR_STATIC;
proxy_cache engintron_static;
proxy_cache_background_update on;
proxy_cache_key "$host$request_uri";
proxy_cache_lock on;
proxy_cache_methods GET HEAD;
proxy_cache_min_uses 1;
proxy_cache_revalidate on;
proxy_cache_use_stale error timeout invalid_header updating http_429 http_500 http_502 http_503 http_504; # Additional options: http_403 http_404
proxy_cache_valid 200 10s;
# Allow rewriting HTTP headers for static assets
proxy_ignore_headers Cache-Control Expires Set-Cookie Vary;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_hide_header Pragma;
proxy_hide_header Set-Cookie;
proxy_hide_header Vary;
# Disable logging
access_log off;