The following RE matches "http://my.domain/video.mp4" successfully but cannot match "http://my.domain/abc/video.mp4".
location ~ "^.+(mp4|mkv|m4a)$" {
root /home/user/Videos;
}
The log of Nginx reads
[05/May/2021:12:29:25 +0800] "GET /video.mp4 HTTP/1.1" status: 206, body_bytes: 1729881
[05/May/2021:12:29:46 +0800] "GET /abc/video.mp4 HTTP/1.1" status: 404, body_bytes: 555
This is wired. Actually, I want URLs under "/service1/" to be mapped to user1's directory and URLs under "/service2" to be mapped to user2's. So I write
location ~ "^/service1/.+(mp4|mkv|m4a)$" {
root /home/user1/Videos;
}
location ~ "^/service2/.+(mp4|mkv|m4a)$" {
root /home/user2/Videos;
}
And as the first example, this config cannot match anything.
I searched a lot on google. No answer can explain this. I want to get it to work. Thanks!