Welcome! Log In Create A New Profile

Advanced

Re: Understanding alias (used as rewrite)

Francis Daly
June 24, 2015 11:44AM
On Tue, Jun 23, 2015 at 11:44:33PM -0700, E.B. wrote:

Hi there,

> Thanks for your ongoing helps! I hope someone
> can advise further

you seem to keep referring to "alias used as rewrite". I do not know
what you mean by that.

Could you explain?

When you do, it may be that it becomes clear where your mental model of
what "alias" (or maybe "rewrite") does, breaks down.


"alias" is, as you noted, documented at http://nginx.org/r/alias. It is
used to identify a filename that should be used to handle the request.

In short: there are two relevant kinds of location: prefix and
regex. ("exact" is a special case of "prefix".)

In a prefix location, the starting part of the request that matches the
"location" value is replaced with the "alias" value, and what results
becomes $request_filename. (There is more to it than that, but that
should be enough for now.)

In a regex location, the entire request is replaced with the "alias"
value, and what results becomes $request_filename.

In your example configs, if you replace the "include" line with something
like

return 200 "location #1: request $request_uri -> file $request_filename\n";

(change the #1 to something that will identify the location to you each
time), then you can use "curl" to make your various requests and see
the responses.

Does that show you how each configuration was used?

If $request_filename identifies a file that does exist, it will
probably be used; if it identifies a file that does not exist, there
will probably be an error. But it all depends on the configuration that
is not yet shown.

And "rewrite" does something different, documented at
http://nginx.org/r/rewrite; it involves uris, not filenames.

f
--
Francis Daly francis@daoine.org

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

Understanding alias (used as rewrite)

E.B. June 22, 2015 06:06AM

Re: Understanding alias (used as rewrite)

Edho Arief June 22, 2015 02:22PM

Re: Understanding alias (used as rewrite)

E.B. June 22, 2015 04:34PM

Re: Understanding alias (used as rewrite)

Edho Arief June 22, 2015 11:20PM

Re: Understanding alias (used as rewrite)

E.B. June 24, 2015 02:46AM

Re: Understanding alias (used as rewrite)

Edho Arief June 24, 2015 06:52AM

Re: Understanding alias (used as rewrite)

Francis Daly June 24, 2015 11:44AM

Re: Understanding alias (used as rewrite)

E.B. June 24, 2015 08:08PM

Re: Understanding alias (used as rewrite)

E.B. June 24, 2015 08:20PM

Re: Understanding alias (used as rewrite)

Francis Daly June 25, 2015 01:54PM

Re: Understanding alias (used as rewrite)

E.B. June 27, 2015 03:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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