How do you dynamically set nginx root based on location?
I can't seem to find information on this specifically, but I'm basically trying to catch a location like:
http://domain.com/project/Content/Images/image.png
and I want it to point to root like this:
/var/www/$project/Content/Images/image.png
This is what I tried to put together, but it doesn't seem to work:
location ~ ^/(?<project>.+)/Content/^(?<content>.+)$ {
root /var/www/$project/Content/$content;
}
I don't seem to be catching this location as I am getting a 404 error which is installed via a php page from which I have try_files in the / directory. This makes me think the regex is wrong, but I'm not sure.
+3
source to share