Files
server/opt/psa/admin/conf/templates/default/domain/service/nginxCacheProxy.php
cutemeli 0bfc6c8425 Initial
2025-12-22 10:32:59 +00:00

34 lines
1.8 KiB
PHP

<?php
/**
* @var Template_VariableAccessor $VAR
* @var array $OPT
*/
?>
<?php if ($VAR->domain->physicalHosting->proxySettings['nginxCacheEnabled']): ?>
proxy_cache_key <?=$VAR->quote($VAR->domain->physicalHosting->proxySettings['nginxCacheKey'])?>;
proxy_no_cache <?=join(' ', array_filter([
'$no_cache',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassHeaderNocache'] ? '$http_pragma' : '',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassHeaderAuth'] ? '$http_authorization' : '',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassGetNocache'] ? '$arg_nocache' : '',
]))?>;
proxy_cache_bypass <?=join(' ', array_filter([
'$no_cache',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassHeaderNocache'] ? '$http_pragma' : '',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassHeaderAuth'] ? '$http_authorization' : '',
$VAR->domain->physicalHosting->proxySettings['nginxCacheBypassGetNocache'] ? '$arg_nocache' : '',
]))?>;
proxy_cache <?="{$VAR->domain->asciiName}_proxy"?>;
proxy_cache_valid <?=$VAR->quote($VAR->domain->physicalHosting->proxySettings['nginxCacheTimeout'])?>;
proxy_cache_use_stale <?=join(' ', array_merge(
$VAR->domain->physicalHosting->proxySettings['nginxCacheUseStale5xx'] ? ['http_500', 'http_502', 'http_503', 'http_504'] : [],
$VAR->domain->physicalHosting->proxySettings['nginxCacheUseStale4xx'] ? ['http_403', 'http_404'] : [],
$VAR->domain->physicalHosting->proxySettings['nginxCacheUseStaleUpdating'] ? ['updating'] : []
) ?: ['off'])?>;
<?php if ($VAR->domain->physicalHosting->proxySettings['nginxCacheUseStaleUpdating']): ?>
proxy_cache_background_update on;
<?php endif ?>
<?php endif ?>