Varnish stops file download after 60 seconds

Image removed.The default installation of Varnish 3 on Debian-based system (including Ubuntu) will set a default timeout for sending files to users (i.e. for users files download) to 60 seconds. To change this limit, it is necessary to update your default Varnish configuration, in /etc/default/varnish. For example, if you have something like this:
DAEMON_OPTS="-a :80 
             -T localhost:6082 
             -f /etc/varnish/default.vcl 
             -S /etc/varnish/secret 
             -s malloc,256m"
make sure you add the send_timeout param, like this (see the -p line): DAEMON_OPTS="-a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p send_timeout=900 -s malloc,256m" This will obviously increase the maximum download time to 900 seconds (15 minutes), which will make it much more practical and less stressfull to download large files. The logic behind this very short limit is that, if you're optimizing your site with Varnish, you shouldn't make it busy with handling one long-term connection with a large file like this (meanwhile, thousands of other connections could have been treated) and your large files should reside on a CDN or something like this.

Comments

Hi Yannick, many thanks for the tip, we will use it for setting up Varnish since it is next on our list. I have a doubt before setting up Varnish tho... I'm now setting up nginx, and I was wondering if I need to implement any rewrite in the .conf file. I have seen the apache version (.htaccess) of Chamilo has a couple of rewrite rules. Do I need to translate them to nginx rewriting syntax? or should I just go ahead with the default install which forwards the petitions to FPM? Thanks in advance

In reply to by YW

Permalink

Hi Joey,
Indeed, Nginx doesn't read .htaccess rules, so you would need to translate at least (should be enough) the chamilo/courses/.htaccess file. *Not* translating them will not result in any failure, but it will leave direct access to your courses files possible for anyone, which you probably would like to avoid.

I haven't got to translate it to Nginx rules, yet, but I've done a bunch of .htaccess-to-nginx translations in the past, so I should be able to do it at some point in the future and add it to the Chamilo install guide. If you can wait for a few weeks, I should be able to do that. If you have suggestions on how to translate them before that, please report them here: http://support.chamilo.org/issues/5939 (just created for you)

Hi Yannick, thanks for your reply. If all we need to translate is the .htaccess file on chamilo/courses, then the task is relatively easy. We will attempt to do the rewrites during this week since we need them done sooner than later. Will report our take on your bugtracker when finished so we can double-check they're ok. Thanks!