Welcome! Log In Create A New Profile

Advanced

Re: "root" directive weirdness

Dennis J.
January 22, 2010 08:00AM
On 01/22/2010 01:45 AM, Marcus Clyne wrote:
> Hi,
>
> Cliff Wells wrote:
>> On Thu, 2010-01-21 at 22:10 +0100, Dennis J. wrote:
>>> Hi,
>>> I'm trying to configure a vhost where in the default case I want it
>>> to get the files from /opt/nginx/html but when the uri starts with
>>> "/users/" I want to to deliver the files from /web/users/ instead:
>>>
>>> location / {
>>> root /opt/nginx/html;
>>> index index.html index.htm;
>>> }
>>>
>>> location ~* ^/users/ {
>>> root /web/users;
>>> rewrite ^/users(/.*) $1 last;
>>> }
> The reason why you're having problems is the 'last' tag on the rewrite,
> which will end the rewrite rules and then look for the corresponding URL
> (which sends it back to the first location). Using 'break' instead would
> prevent this, and do as you expect. However, for this situation, the
> second regex is an unnecessary waste of processing.

Once the server configuration is complete it will be much more complex than
the one above. That was only a simplified example to illustrate the
problem. I didn't now that a "last" would send nginx back to the location
stage of processing. With that in mind the processing makes sense of
course. Thanks for the explanation!

Regards,
Dennis

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

"root" directive weirdness

Dennis J. January 21, 2010 04:16PM

Re: "root" directive weirdness

Cliff Wells January 21, 2010 06:12PM

Re: "root" directive weirdness

Marcus Clyne January 21, 2010 07:52PM

Re: "root" directive weirdness

Cliff Wells January 21, 2010 08:02PM

Re: "root" directive weirdness

Marcus Clyne January 21, 2010 10:18PM

Re: "root" directive weirdness

Cliff Wells January 22, 2010 01:18AM

Re: "root" directive weirdness

Marcus Clyne January 22, 2010 01:46AM

Re: "root" directive weirdness

Dennis J. January 22, 2010 08:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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