Static files download

Igor Sysoev igor at
Thu Jun 10 16:15:35 MSD 2010

On Thu, Jun 10, 2010 at 12:22:04PM +0200, Axel wrote:

> thanks for your help. Actually I wrote my entire configuration file again from scratch. It works very well now:
> I'll post this configuration somewhere for Kohana users because it's been was a pain to get it work. 

This is wrong configuration.

1) All these

      set $server_type     prod;
      set $medias_path     /var/www/xxxx/medias;

are not macros, but run-time directives. They will run every request.
It's much better to set them in place:

      fastcgi_param SERVER_TYPE  prod;
      fastcgi_param MEDIAS_PATH  /var/www/xxxx/medias;

2) This

      if (!-e $request_filename) {
          rewrite ^(.+)$ /index.php$1 last;

is one of the worst configuration practice.
Never do this, never repeat this.

The right way is:

    location / {
        try_files   $uri  @kohana;

    location @kohana {
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param DOCUMENT_URI    /index.php$uri;
        ... other fastcgi_params

Igor Sysoev

More information about the nginx mailing list