Serving Static Files

vanderkerkoff nginx-forum at
Mon Jun 8 13:32:50 MSD 2009

Hello everyone.  I've been using nginx for a while now but haven't scratched the surface, just used recommended options.

I decided I needed to know more about it, so here I am.

In the main http module nginx.conf file there are these lines

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

I assumed what they meant is that if a client tries to download a file that is described in the mime.types file, then nginx will handle that download for me.

In one of our server blocks I've noticed that another developer has a location block like this

location ~* ^.+\.(docx|pdf|mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|rtf|mpeg|jpg|jpeg|gi
f|png|ico|css|bmp|js)$ {
            root   /var/django/django_projects/glamlifenews;
            limit_rate 2000K;
            access_log  /var/django/conf/log/glamlifenews_nginx_django_media.log  download;
            access_log   off;

Would I be right in assuming that what would happen here is that in this particular website nginx would still handle the download, but the extra options are there to handle logging the downloads for this particular app, setting the limit_rate and giving a specific place to download the files from?

Would this also speed up the download process?

Any help, greatly appreciated.

Posted at Nginx Forum:,2700,2700#msg-2700

More information about the nginx mailing list