0
votes

I am trying to provide a download with X-Sendfile on my nginx server. I have the most up to date version of nginx, and php5.

The file requested file exists but it just downloads a empty 0kb file, with no content but with the right filename. I dont do any output before the download starts.

At the beginning I had output after the "download" and everything i outputed was readable in the file.

I looked into the nginx docu http://wiki.nginx.org/XSendfile and set the folder which is containing the download file to "internal".

1
You should use X-Accel-Redirect: URI. And pay attention, that nginx expects URI, not file path.Alexey Ten
And what is in nginx config?Alexey Ten

1 Answers

0
votes

You've confused URI and disk path. You're config should be

location ^~ /dl/ {
    internal;
    alias /real/path/to/Download/;
}

I've added modifier ^~ to prevent accidental execution of PHP files in /dl/.