nginx regex locations w/ different roots not working as expected
Posted
by
Wells Oliver
on Server Fault
See other posts from Server Fault
or by Wells Oliver
Published on 2013-10-20T23:26:06Z
Indexed on
2013/10/21
3:57 UTC
Read the original article
Hit count: 418
nginx
I have the following two rules:
location / {
root /var/www/default;
}
location ~* /myapp(.*)$ {
root /home/me/myapp/www;
try_files $uri $uri/ /handle.php?url=$uri&$args;
}
When I browse to myapp/foo
it works- kind of, the error is logged as a 404: *3 open() "/var/www/default/handle.php" failed (2: No such file or directory)
- so its handling the regex match but just not using the right document root-- why is this?
For the record, I am trying to get /myapp/* requests handled by the second location, and everything else the first.
© Server Fault or respective owner