Welcome! Log In Create A New Profile

Advanced

"root" directive weirdness

Dennis J.
January 21, 2010 04:16PM
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 problem is that when I access "/users/index.html" the second location
matches and the rewrite rule gets applied but the "root" directive is
ignored and instead the one from the first location section is applied
resulting in the delivery of the file "/opt/nginx/html/index.html".
Am I getting something wrong about the location/root directives or is this
a problem with nginx?

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: 189
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