mod_xsendfile is an apache2 module which come handy when you need to serve static files through a secondary application layer or a proxied web server, both tend to serve static files slower and less efficiently than apache does. In such cases you want to delegate the request (file path) to apache so that the secondary layer/proxied web server are freed to move on and process other requests. A common example is a php download handler that needs to go to the db to fetch the file path, check permissions, etc but don't want to deal with the actual file transfer, another common example is a ruby on rails proxied web server such as mongrel which is slow in serving static files under stress due it's concurrency model and can quickly become a bottle neck. For more information on mod_xsendfile and how to configure it go here.
The above information well known, however mod_xsendfile installation documentation states the following:
1. Grab the source.
2. Compile and install:
>> apxs -cia mod_xsendfile.c
3. Restart apache
4. That's all.
If you try this on OSX the compilation step will fail due to missing architecture flags, hence, use the following instead:
>> apxs -cia -Wc,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" -Wl,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" mod_xsendfile.c
This will compile mod_xsendfile in all 4 OSX flavors, which should cover your case. Naturally, you can change the architecture flag to just the one that is relevant to your hardware. More info here.
Thursday, October 1, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment