add (hidden) _NGINX_XACCEL_PREFIX which uses nginx X-Accel-Redirect to serve static files faster

This commit is contained in:
Andrew Dolgov 2018-08-20 09:14:10 +03:00
parent 04ad631a08
commit c5c3a0a2a8
1 changed files with 7 additions and 1 deletions

View File

@ -2586,7 +2586,13 @@
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT";
header("Last-Modified: $stamp", true);
return readfile($filename);
if (defined('_NGINX_XACCEL_PREFIX') && _NGINX_XACCEL_PREFIX) {
header("X-Accel-Redirect: " . _NGINX_XACCEL_PREFIX . "/" . $filename);
return false;
} else {
return readfile($filename);
}
} else {
return false;
}