nginx regex locations w/ different roots not working as expected
- by Wells Oliver
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.