I have queries like /api/lang?lang=en
which I want to serve with nginx as /server/i18n-angular/en.json
. How can I do that?
I have the following directory structure:
/public/
/server/i18n-angular/en.json
I have the following configuration, but nginx says it is wrong to use index directive at that point.
server {
root /public
...
location /api/lang {
if ($args ~* "\?lang=(.+)") {
set $language $1;
index ../server/i18n-angular/$language.json;
}
}
}
What directive should I use instead of index
?