1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

nginx XSendfile for handling attachments

Discussion in 'Server Configuration and Hosting' started by D.O.A., Mar 23, 2013.

  1. D.O.A.

    D.O.A. Well-Known Member

    We've got a lot (50,000+) of attachments on our forum and Xsendfile/X-accel was recommended. Can any proficient nginx users here verify the below is working as intended? We're trying to optimize attachment handling without breaking view counters or removing permissions.

    I have tested this in /XenForo/ViewPublic/Attachment/View.php

    return new XenForo_FileOutput($this->_params['attachmentFile']);

    replaced with


    So in theory nginx is doing all the work now?
    I'm wondering would this also require a defined internal location aka into /internal_data folder etc on the nginx config side.
    Xon and HittingSmoke like this.
  2. D.O.A.

    D.O.A. Well-Known Member

  3. silence

    silence Well-Known Member

    Hmmm I threw this into my site and since I'm mostly using attachment thumbnails, I'm not noticing an improvement.
  4. D.O.A.

    D.O.A. Well-Known Member

    Configure your server stanza to support it also, it's taking the load of php for me
  5. silence

    silence Well-Known Member

    What do you mean 'server stanza'?
    Would you be so generous as to post any snippits that could be of use to other users?
  6. HittingSmoke

    HittingSmoke Active Member

    I'm very interested in seeing how this turns out. Attachment optimization is something that's been bugging me. I don't want to lose the ability to apply permissions to attachments but serving them from PHP is never ideal.

Share This Page