February 11, 2011 06:12AM
Igor Sysoev Wrote:
-------------------------------------------------------
> On Fri, Feb 11, 2011 at 05:08:40AM -0500, Dayo
> wrote:
> > Hello all.
> >
> > I currently have my php set up as so
> >
> >
> > ...
> > location ~ \..*/.*\.php$ {
> > return 403;
> > }
> > location ~* ^.+\.php$ {
> > try_files $uri/fail @proxy;
> > }
> > location @proxy {
> > proxy pass etc
> > }
> > location
> >
> some-location-that-sometimes-needs-rewriting-in-ap
> ache-htaccess {
> > try_files $uri $uri/ @proxy;
> > }
> > ...
> >
> >
> > Is there a way where when a '.php' file is
> equested, I just pass the
> > request to the '@proxy' location.
> >
> > Now I have to use '$uri/fail' (a location that
> will never be found) so
> > that it will fail and then go to the '@proxy'
> location.
> >
> > I see the time spent determining that
> '$uri/fail' does not exist to be a
> > waste but I can't do 'try_files @proxy'
> directly.
> >
> > An option at also works is ...
> >
> >
> > ...
> > location ~* ^.+\.php$ {
> > error_page 403 = @proxy;
> > return 403;
> > }
> > ...
> >
> >
> > Just wondering which is more efficient.
>
> The one and single efficient and scaleable way is
> to define explictly
> how do you want to handle location, that is:
>
> location ~* ^.+\.php$ {
> # BTW, what does this hack mean ???
> location ~ \..*/.*\.php$ {
> return 403;
> }
Got it from here: http://forum.nginx.org/read.php?2,88845,88854#msg-88854
Not using fastcgi at present but wanted to stop any '.jpg/.php' type attempts
>
> proxy_pass ...
> }
>
> The lesser you have dependences, the lesser you
> will have maintence
> issues in future. Yes, you have to write more, but
> you see what
> how exactly this location is handled. If you ever
> need to change
> proxied server address, your favourite editor with
> find/replace
> functionality is your friend.
Thanks but I prefer to centralise things so that I only have to edit in one place and not run the risk of missing stuff out.
So in terms of the try files and error page options, can you advise which is better ... taking note of what you said about doing each proxy pass every time?

Thanks
Subject Author Posted

Passing request directly to named location

Dayo February 11, 2011 05:08AM

Re: Passing request directly to named location

Igor Sysoev February 11, 2011 05:26AM

Re: Passing request directly to named location

Dayo February 11, 2011 06:12AM

Re: Passing request directly to named location

Igor Sysoev February 11, 2011 06:42AM

Re: Passing request directly to named location

Dayo February 11, 2011 07:08AM

Re: Passing request directly to named location

Dayo February 13, 2011 07:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 241
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