Install problems with XSendFile on Ubuntu

Posted by Dan on Server Fault See other posts from Server Fault or by Dan
Published on 2011-03-20T14:35:09Z Indexed on 2011/03/20 16:12 UTC
Read the original article Hit count: 347

Filed under:
|
|

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?

© Server Fault or respective owner

Related posts about apache

Related posts about ubuntu