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

Doc icantthinkofone at charter.net
Sat Mar 29 18:23:08 UTC 2014


On Sat, Mar 29, 2014 at 12:12 PM, Adie Nurahmadie wrote:


On Sat, Mar 29, 2014 at 11:50 PM, Doc  < icantthinkofone at charter.net 
<javascript:parent.wgMail.openComposeWindow('icantthinkofone at charter.net')> 
>  wrote:
On my site, music can be played by going to  
http://mysite.com/music/billyjoel/song.mp3 
<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 
<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, 

Ack! Yes. Exactly. I keep forgetting that. Thank you.

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 
<javascript:parent.wgMail.openComposeWindow('nginx at nginx.org')>
http://mailman.nginx.org/mailman/listinfo/nginx 
<http://mailman.nginx.org/mailman/listinfo/nginx>


  <http://mailman.nginx.org/mailman/listinfo/nginx>
-- 
regards,
Nurahmadie
-- 

On Sat, Mar 29, 2014 at 11:50 PM, Doc < icantthinkofone at charter.net 
<javascript:parent.wgMail.openComposeWindow('icantthinkofone at charter.net')> 
> wrote:
On my site, music can be played by going to 
http://mysite.com/music/billyjoel/song.mp3 
<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 
<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 
<javascript:parent.wgMail.openComposeWindow('nginx at nginx.org')>
http://mailman.nginx.org/mailman/listinfo/nginx 
<http://mailman.nginx.org/mailman/listinfo/nginx>


  <http://mailman.nginx.org/mailman/listinfo/nginx>
-- 
regards,
Nurahmadie
-- 

------------------------------

_______________________________________________
nginx mailing list
nginx at nginx.org 
<javascript:parent.wgMail.openComposeWindow('nginx at nginx.org')>   
<javascript:parent.wgMail.openComposeWindow('nginx at nginx.org')>
http://mailman.nginx.org/mailman/listinfo/nginx 
<http://mailman.nginx.org/mailman/listinfo/nginx>   
<http://mailman.nginx.org/mailman/listinfo/nginx>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140329/eec0f624/attachment-0001.html>


More information about the nginx mailing list