Don't understand why this directive causes a 404 in mp3 only

Adie Nurahmadie nurahmadie at gmail.com
Sat Mar 29 17:12:15 UTC 2014


On Sat, Mar 29, 2014 at 11:50 PM, Doc <icantthinkofone at charter.net> wrote:

> On my site, music can be played by going to
> http://mysite.com/music/billyjoel/song.mp3 (for example).
> You can download the same song by going to
> http://mysite.com/music/billyjoel/download/song.mp3.
>
> The path including "download" is aliased and the default mime type changed
> as shown here:
>
> location /music/billyjoel/play/ {
>     types{
>         audio/mp3 mp3;
>     }
> }
>
> location /music/billyjoel/download/ {
>     types{}
>     default_type application/octet-stream;
>     alias /(location of root goes here)/music/billyjoel/play/;
> }
>
> This works as intended. However, I set expires and access_log directives
> for css/jpg/woff, etc. like this and the mp3 will no longer download and I
> get a 404 with a "file not found" error in the error logs:
>
> location ~* ^.+\.(mp3|jpg|css)$ {
>     expires modified +30d;
>     access_log off;
> }
>
>
Location with regex will get matched first,
Looks like the download request for mp3 files get served by: `location ~*
^.+\.(mp3|jpg|css)$`
and since you didn't set any alias or location over there, it will returns
404.


> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
regards,
Nurahmadie
--


On Sat, Mar 29, 2014 at 11:50 PM, Doc <icantthinkofone at charter.net> wrote:

> On my site, music can be played by going to
> http://mysite.com/music/billyjoel/song.mp3 (for example).
> You can download the same song by going to
> http://mysite.com/music/billyjoel/download/song.mp3.
>
> The path including "download" is aliased and the default mime type changed
> as shown here:
>
> location /music/billyjoel/play/ {
>     types{
>         audio/mp3 mp3;
>     }
> }
>
> location /music/billyjoel/download/ {
>     types{}
>     default_type application/octet-stream;
>     alias /(location of root goes here)/music/billyjoel/play/;
> }
>
> This works as intended. However, I set expires and access_log directives
> for css/jpg/woff, etc. like this and the mp3 will no longer download and I
> get a 404 with a "file not found" error in the error logs:
>
> location ~* ^.+\.(mp3|jpg|css)$ {
>     expires modified +30d;
>     access_log off;
> }
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
regards,
Nurahmadie
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140330/08f6d78d/attachment.html>


More information about the nginx mailing list