vBulletin: attachments downloads 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 too much users. But if you do, attachments downloads from PHP could become one of performance 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. Like it’s mentioned in readme file, it intends to reduce server load and it really does. 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.

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

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

location ~* /uploads/(.*).thumb$ { 
expires 24h; 
location /uploads {
alias /uploads;internal;
expires 24h;
sendfile on;

Note that in this case your thumb files will be accessible without authorization. After nginx reload it should start to server attachments by itself.