Static files download

Axel junk at devignon.fr
Thu Jun 10 12:09:58 MSD 2010


Hello, 

thanks for your answers. The thing is that I use a framework (Kohana) with rewrite rules. With your system Grzegorz, an URL like http://www.xxxx.com/video/test_1.htm (rewritten by the framework in video.php?id=1) will not be parsed as PHP, will it? I found and adapted this server configuration for Kohana. Obviously it doesn't work properly.

I also tried to have a very simple / location (like yours), a .php location and a kohana location. But this http://www.xxxx.com/ (with auto index to index.php) doesn't work either. When U browse this URL, the index.php is downloaded instead of being parsed.

Axel



Le 10 juin 2010 à 00:05, Grzegorz Sienko a écrit :

> Hello.
> 
> It's passed to fastcgi because of location / that captures uri to pass
> to fastcgi.
> 
> I will say, that: It's not the best solution what Igor suggest. It
> will get rid of the problem, but is not a real solution.
> 
> You should use:
> 
> location ~ / {
> try_files $uri $uri/  @framework;
> }
> 
> location ~ \..*/.*\.php$ {
> return 403;
> }
> 
> location ~ \.php$ {
>                     fastcgi_pass 127.0.0.1:9000;
>                     fastcgi_index index.php;
>                     fastcgi_param SCRIPT_FILENAME  $document_root/index.php;
>                     include fastcgi_params;
> }
> 
> 
>> I tried to review all my configuration. I do not understand why PDF files are returned inline to the browser. Images, videos and flash files are properly sent, why not pdt and zip?
>> has anyone the same issue?
> 
> You have it in debug log, in part where nginx test location. Because
> nginx test all you location that you have in your config, the uri with
> pdf file is captured by / location and proxed to fastcgi. With Igor
> suggestion, pdf will be added to static content location. But I will
> suggest, to properly configured the location that are responsible for
> capturing php file, because you will have a problem with all different
> types of files, that you don't put in that static location. like doc,
> xls, odt .. whatever.
> 
> BTW, it's not better (for reader, at least :} )?:
> 
> - location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff|\.pdf$ {
> + location ~* \.(css|js|jpg|jpeg|png|gif|swf|svg|tiff|pdf)$ {
> 
> -- 
> Best Regards
> Grzegorz Sieńko
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list