sendfile was on or off at ngnix ?

Dauser2007

Verified User
Joined
Dec 5, 2007
Messages
209
hello ,

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


thanks alex for your reply.

Yes, i have NGINX with custombuild.

but looks this Nginx had to Customization in nginx.conf for domain.com, any idea?

Br,
 
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?
 
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?


i have root access

Before i use apache, after convert to nginx, the rewrite not work for this sendfile .
 
i have customization in nginx.conf for mydomain.com (all file are rar type)

location /myfilefolder/ {
internal;
alias /home/mydomian/domains/mydomian.com/public_html/;
}


but looks the browser don't know the archive in unknow format. very strange


br.,
 
What is your question? It seems hardly cat I help you as I don't understand what you want. Probably somebody else here can guess what you need.
 
If I understand correctly, he changed his default /public_html folder in nginx to /myfolder and he uses .rar files in there.
But the browser does not recognize the .rar file format, doesn't recognize this archive and says "unknown format". So he can't download the files.

Ofcourse my interpretation could be wrong too. ;)
 
i have fixed the archive format.
maybe my php file problem , can not detect the file location when i download, this make me crazy :-(

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());
}
 
Back
Top