I have the follwoing Nginx configuration:
root /usr/share/nginx/files;
location / {
#root /usr/share/nginx/files;
autoindex on;
}
location /gallery {
rewrite "^(/gallery)/[A-Za-z0-9]{8}/([0-9]{1,4}.jpg)$" $1/$2 break;
autoindex on;
}
Directory gallery
with images is located in /usr/share/nginx/files
.
I would like to have one more location that will use images from gallery
directory.
I’ve tried to do it in different ways:
location /new {
rewrite "^/new/[A-Za-z0-9]{8}/([0-9]{1,4}.jpg)$" $document_root/gallery/$1 break;
autoindex on;
}
But without luck. I get error message that such directory or file doesn’t exist.
Could you please advise what proper way to access directory with content using different locations?