Install problems with XSendFile on Ubuntu
- by Dan
I installed the apache dev headers:
sudo apt-get install apache2-prefork-dev
Downloaded and compiled the module as outlined here: http://tn123.ath.cx/mod_xsendfile/
Added the following line to /etc/apache2/mods-available/xsendfile.load:
LoadModule xsendfile_module /usr/lib/apache2/modules/mod_xsendfile.so
Added this to my VirtualHost:
<VirtualHost *:80>
XSendFile on
XSendFilePath /path/to/protected/files/
Enabled the module by doing:
sudo a2enmod xsendfile
Then I restarted Apache. Then this code still just provides me with an empty file with 0 bytes:
file_path = '/path/to/protected/files/some_file.zip'
file_name = 'some_file.zip'
response = HttpResponse('', mimetype='application/zip')
response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(file_name)
response['X-Sendfile'] = smart_str(file_path)
return response
And there is not in the Apache error log that pertains to XSendFile. What am I doing wrong?