Welcome! Log In Create A New Profile

Advanced

Re: Static files download

June 10, 2010 09:28AM
On Thu, Jun 10, 2010 at 03:09:34PM +0200, Axel wrote:

> Igor,
>
> I'm trying to follow your advise but look:
>
>
> # ROUTING TO KOHANA IF REQUIRED
> location / {
> try_files $uri $uri/ @kohana;
> }
>
> # HANDLES THE REWRITTEN URLS TO KOHANA CONTROLLER
> location @kohana
> {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> include fastcgi_params;
> include hom_params;
> fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> }
>
> # FOR PHP FILES NOT HANDLED BY KOHANA
> location ~* \.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> include hom_params;
> }
>
>
> Nearly everything works at this stage EXCEPT:
>
> when I browse an URL like "http://www.xxxx.com/share.php", this file (share.php) does not exist in the document root therefore this URL should be handled by @kohana.
> As an answer, I get a "No input file specified". I'm pretty sure the .php location is taking over @kohana. I tried to add a break in @kohana but no success.
>
> Do you see what I mean?

The single "break" is meanless directive.

You should add try_files test in \.php$ location:

location ~* \.php$ {
+ try_files $uri @kohana;
fastcgi_pass 127.0.0.1:9000;

Please read also the order of location processing:
http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration

> Le 10 juin 2010 à 14:15, Igor Sysoev a écrit :
>
> > 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: http://pastebin.com/pCL2dy9Z
> >> 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;
> > break;
> > }
> >
> > 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_pass 127.0.0.1:9000;
> > fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> > fastcgi_param DOCUMENT_URI /index.php$uri;
> > ... other fastcgi_params
> > }
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://nginx.org/mailman/listinfo/nginx
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Static files download

Axel June 09, 2010 10:44AM

Re: Static files download

Igor Sysoev June 09, 2010 10:46AM

Re: Static files download

Axel June 09, 2010 10:52AM

Re: Static files download

Igor Sysoev June 09, 2010 11:02AM

Re: Static files download

Axel June 09, 2010 11:40AM

Re: Static files download

Axel June 09, 2010 02:10PM

Re: Static files download

Igor Sysoev June 09, 2010 02:16PM

Re: Static files download

Grzegorz Sienko June 09, 2010 06:10PM

Re: Static files download

Axel June 10, 2010 04:18AM

Re: Static files download

Igor Sysoev June 10, 2010 04:22AM

Re: Static files download

Axel June 10, 2010 04:42AM

Re: Static files download

Axel June 10, 2010 06:28AM

Re: Static files download

Igor Sysoev June 10, 2010 08:20AM

Re: Static files download

Axel June 10, 2010 09:14AM

Re: Static files download

Igor Sysoev June 10, 2010 09:28AM

Re: Static files download

edogawaconan June 10, 2010 09:30AM

Re: Static files download

Axel June 10, 2010 10:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 154
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready