F
F
Freud's cat2019-05-14 14:08:14
Nginx
Freud's cat, 2019-05-14 14:08:14

How to write such a rule?

There is a file storage with the following system:

каталог-с-сайтом/files/username/albumName/subAlbumName/file.jpg

The nesting level is always fixed.
Now the files are given for reading like this:
location /files/ {
     alias /var/www/my-site/files/;
}

I would like a rule that would give all files from the directory, the path to which is identical to the URI and would match this regular /id[a-z0-9]*/[-А-ЯЁа-яёA-Za-z]*/[-0-9]*/
expression/id4j23jrv2rv238/Мои%20файлы/07-12-2015/
var/www/my-site/files/id4j23jrv2rv238/Мои файлы/07-12-2015/

Please, help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Freud's cat, 2019-05-14
@medbrat69

I wrote it myself, maybe it will be useful to someone.

location ~ /id[a-z0-9]+/.+/[-0-9]+ {
        root /var/www/my-site/files/;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question