I want to rewrite example.com/videos/name/
to the MP4 file videos/name.mp4
and serve it with content type video/mp4
as if the user would have requested the video directly with example.com/videos/name.mp4
.
How can I do that with nginx
?
CodePudding user response:
I got it:
location = /videos/ {
types { } default_type "video/mp4";
rewrite ^/name/$ /videos/name.mp4 last;
}