Dauser2007
Verified User
- Joined
- Dec 5, 2007
- Messages
- 185
hello ,
sendfile was on or off at ngnix by DA default settings ? any friend use it ?
Br.,
sendfile was on or off at ngnix by DA default settings ? any friend use it ?
Br.,
Hello,
sendfile is OFF by default: http://nginx.org/en/docs/http/ngx_http_core_module.html#sendfile
With Directadmin it is ON if you install NGINX with custombuild.
Defaults can be found under:
/usr/local/directadmin/custombuild/configure/nginx
/usr/local/directadmin/custombuild/configure/nginx_reverse
Not too sure what you asking about... if one domain has a customization, then you or somebody else who has admin's or root's access customized it. What exactly you want to know?
function downloadXFile($fileLocation, $fileName, $maxSpeed = 1024)
{
if (connection_status() != 0)
return (false);
header("Content-Transfer-Encoding: binary\n");
header('Content-type: application/octet-stream');
header("X-Accel-Redirect:$fileLocation");
$contentDisposition = 'attachment';
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
header("Content-Disposition: $contentDisposition;filename="$fileName"");
} else {
header("Content-Disposition: $contentDisposition;filename="$fileName"");
}
header("Accept-Ranges: bytes");
$range = 0;
$size = filesize($fileLocation);
if (isset($_SERVER['HTTP_RANGE'])) {
list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
str_replace($range, "-", $range);
$size2 = $size - 1;
$new_length = $size - $range;
header("HTTP/1.1 206 Partial Content");
header("Content-Range: bytes $range$size2/$size");
} else {
$size2 = $size - 1;
header("Content-Range: bytes 0-$size2/$size");
}
if ($size == 0) {
die('Zero byte file! Aborting download');
}
exit;
return ((connection_status() == 0) and !connection_aborted());
}