0

I want serve static files with nginx.

User will request like this format:

http://test.com/files/ea624cf923ea

Actual file location will like this

/files/ea/62/4c/f923ea

How can I serve this file?

I'm stuck with this:

How to split request_uri and send reformatted request_uri or some variable to try_files

changhwan
  • 103
  • 3

1 Answers1

0

This should work

location /files/ {
    rewrite "^(/files/..)(..)(..)(.{6})$" $1/$2/$3/$4 break;
}
Alexey Ten
  • 8,435
  • 1
  • 34
  • 36