Welcome! Log In Create A New Profile

Advanced

Re: Debugging `try_files` with 404 as a last resort

Francis Daly
November 14, 2018 03:24AM
On Tue, Nov 13, 2018 at 08:30:08PM -0500, petecooper wrote:
> Francis Daly Wrote:

Hi there,

> I think my question could perhaps be
> worded: is there a `try_files` option where I can have $uri, then $uri/,
> then `index.php` and finally `=404` if all else fails.

I believe "not directly".

You possibly could have try_files falling back to a uri which is handled
in a location which in turn does try_files?

> > http://nginx.org/r/try_files
> >
> > The final argument to try_files is a uri or =code. "code" is
> > returned. "uri" is searched for across all locations (due to an
> > internal
> > redirect).
> >
> > The other arguments to try_files are files.
>
> This is how I understood it, thank you for confirming!
>
> > Does a file with the name $document_root/index.php?$args (expanding
> > the
> > two variables) exist? If not, processing will continue until the uri
> > or
> > =code at the end of the argument list.
>
> I know the file `index.php` exists in the `root`. Would using the two
> expanded variables in a log be sufficient to confirm Nginx can see it, or am
> I missing something?

If $args is empty, then your config asks nginx to serve the file
`index.php?`, which is not the same as the file `index.php`.

Basically, try_files is for trying files, and gives one non-file
fallback. You seem to want more than one non-file fallback.

Maybe you can built something close to what you want using error_page?

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Debugging `try_files` with 404 as a last resort

petecooper November 13, 2018 05:23PM

Re: Debugging `try_files` with 404 as a last resort

Francis Daly November 13, 2018 06:32PM

Re: Debugging `try_files` with 404 as a last resort

petecooper November 13, 2018 08:30PM

Re: Debugging `try_files` with 404 as a last resort

Francis Daly November 14, 2018 03:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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