Welcome! Log In Create A New Profile

Advanced

Re: Nginx 1.7.0: location @php

Francis Daly
May 31, 2014 07:28AM
On Sat, May 31, 2014 at 06:31:09AM -0400, TECK wrote:

Hi there,

>> Perhaps the request that you made did not match the location blocks that
>> you showed?

> If that would be the case, the proper code posted earlier would not work, so
> this is not the case.

That's a reasonable assumption to make, if I can reproduce your reported
problem.

When I use

location ^~ /setup {
try_files $uri $uri/ /setup/index.php?$uri&$args;
location ~ \.php$ {
try_files @php =404;
}
}

and I request /setup/real.php, I get back 404, not the unparsed content
of /usr/local/nginx/html/setup/real.php or anything else.

When I request /setup/fake.php, I get back 404.

When I request /other/real.php, I get back the unparsed content of
/usr/local/nginx/html/other/real.php.

Because I have shown you the config, the request, and the response, you
(and anyone else) can repeat the tests. If you get a different response,
then there is something extra involved that should be investigated before
the problem can be understood.

Perhaps different versions of nginx are involved. Perhaps different
modules are compiled in. Perhaps other configuration applies that was
not provided in the original example. After the reproducible test case
shows itself to be really reproducible, those differences possibly can
be ignored.

> I understand the try_files concept very well.

The older http://forum.nginx.org/read.php?2,217122 (and
replies) suggests that you didn't; and this thread (at
http://forum.nginx.org/read.php?2,250342 plus replies) suggests that
you don't.

> My original question was how to avoid repeating
> a segment of configuration code endless times,

No, it wasn't.

It may have been what you intended, but it wasn't what you asked.

http://forum.nginx.org/read.php?2,250342

> more exactly this:
> try_files $uri =404;
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_pass fastcgi;
> fastcgi_param PATH_INFO $fastcgi_path_info;
> fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
> include fastcgi.conf;
>
> Using logic and the examples provided into Nginx documentation what I posted
> previously should work.

No, it shouldn't. http://nginx.org/r/try_files.

"file", "uri", and "=code" are different things. "..." means "optional
repetition of the previous" -- so there can be multiple "file" parameters,
and exactly one "uri" or exactly one "=code".

If there is a phrasing that would make the documentation clearer on that
point, I'm sure it would be welcomed. (But it seems clear to me already,
so I'm not sure what to change.)

> Can you provide a solution to my question?

http://nginx.org/r/include

f
--
Francis Daly francis@daoine.org

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

Nginx 1.7.0: location @php

TECK May 25, 2014 05:49AM

Re: Nginx 1.7.0: location @php

Francis Daly May 25, 2014 09:30AM

Re: Nginx 1.7.0: location @php

TECK May 31, 2014 01:59AM

Re: Nginx 1.7.0: location @php

Francis Daly May 31, 2014 06:00AM

Re: Nginx 1.7.0: location @php

TECK May 31, 2014 06:31AM

Re: Nginx 1.7.0: location @php

Francis Daly May 31, 2014 07:28AM

Re: Nginx 1.7.0: location @php

TECK June 01, 2014 11:47PM

Re[2]: Nginx 1.7.0: location @php

artem June 02, 2014 02:26AM

Re: Nginx 1.7.0: location @php

support June 02, 2014 02:32AM

Re: Nginx 1.7.0: location @php

TECK June 04, 2014 11:36PM

Re: Nginx 1.7.0: location @php

Jonathan Matthews June 02, 2014 07:52AM

Re: Nginx 1.7.0: location @php

TECK June 04, 2014 11:41PM

Re: Nginx 1.7.0: location @php

Reinis Rozitis June 05, 2014 04:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 137
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready