I have the following piece of magic in our Nginx configuration:
location /uploads {
alias /mnt/macchina;
location ~ ^/uploads/ {
try_files $uri @rewrite;
}
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
It works, but doesn't look like poetry to me, so I'm thinking there might be a simpler approach.
The goal is that for /uploads/
Nginx should see root
as /mnt/macchina
and try_files
at $uri
or goto @rewrite
where it should still see root
as /mnt/macchina
.
Is there a better way?