diff options
author | Andrew Dolgov <[email protected]> | 2018-08-20 09:14:10 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-08-20 09:14:10 +0300 |
commit | c5c3a0a2a8febaa2b1ebcae6c17ff4398a9da6c7 (patch) | |
tree | c003e409032ffb9d6ea5885e1e1ce24936d37dc9 /include/functions.php | |
parent | 04ad631a08e33c30ba506ed07e93f1815434018d (diff) |
add (hidden) _NGINX_XACCEL_PREFIX which uses nginx X-Accel-Redirect to serve static files faster
Diffstat (limited to 'include/functions.php')
-rwxr-xr-x | include/functions.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/functions.php b/include/functions.php index b6e49716c..a4e0e4d02 100755 --- a/include/functions.php +++ b/include/functions.php @@ -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; } |