vBulletin: attachments service optimization using vb-accelerator

By default vBulletin uses PHP to deal with attachment downloads. It means that to provide a file from forum attachments to a user PHP process reads it and then starts to output it. This would work ok if you don’t have to much users. But if you do attachments downloads from PHP could become one of bottlenecks. From the other hand, nginx allows to serve such files by itself if you backend issues X-Accel-Redirect header. If you are not familiar with it you might want to take a look at detailed description on nginx wiki .  So, if you have nginx installed on your vBulletin box you could use vb-accelerator by Vitaly Puzrin for serving attachments by nginx. It will work  if you have Apache behind nginx as well.  Here is what you need to do to install it.

1. Login to admin area of your  vBulletin.

2. Download XML file from github to your local computer.

3. Upload XML file to a server from Plugins & Products menu item.

5. Make sure your setting for an addon are correct. You can do it in Settings/Options, item VB Accelerator.

6. Configure nginx to enable  X-Accel-Redirect:

location ~* /uploads/(.*).thumb$ {
expires 24h;
}

location /upoads {
open_file_cache max=1024 inactive=600s;
open_file_cache_valid 2000s;
open_file_cache_min_uses 1;
open_file_cache_errors on;
alias /upoads;
internal;
expires 24h;
sendfile on;
}