<div><img src="cid:DD1B0FDD-4E40-431C-BE43-D759FD06A122" style="width: 179px; height: 176px;">
</div><div><br></div><div>I knew that location are matched 1 time but I didn't noticed the |mp3 T_T</div>
                <div><div><br></div><div>Thank you very much, I'm understanding more and more nginx.</div><div>I think it's done, I just have to deal with the CPanel NGinx module devs to change include place (in order to avoid this case another time).</div><div><br></div><div>Good night !</div><div>---<br>Cordialement, Adnan RIHAN.<br>
<u>Président</u>-<u>Fondateur</u> de l'association (de loi 1901) <a href="http://www.virtual-info.info/" target="_blank"><b>Virtual-Info</b></a>, <i>hébergeur Web et Serveurs de Jeux</i>.<br>
<a href="http://rihan.fr/" target="_blank"><u>Consultant</u></a>-<u>Technicien Supérieur</u> en <i>Informatique de Gestion</i>.<br><u>Ambassadeur</u> <a href="http://lyt.me/7E" target="_blank"><b>Qt</b></a> (Projet <a href="http://rihan.fr/fr/projets/tagpg" target="_blank"><b>Tag-PG</b></a>).<u><br></u></div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">Le vendredi 30 mars 2012 à 20:14, Francis Daly a écrit :</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>On Fri, Mar 30, 2012 at 05:45:05PM +0200, Adnan RIHAN wrote:</div><div><br></div><div>Hi there,</div><div><br></div><blockquote type="cite"><div>Then, here is the vhost:</div></blockquote><div><br></div><div>Great, this shows why things are working the way they are.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div>location ~* ^.+.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|iso|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|ogv|ogg|flv|swf|mpeg|mpg|mpeg4|mp4|avi|wmv|js|css)$ {</div></blockquote></blockquote><div><br></div><div>This is the first regex location that matches mp3 urls, so this is the</div><div>one that will be used.</div><div><br></div><div>For what I think you want to do, you should remove "|mp3" from up there,</div><div>and then have the separate "~* \.mp3$" location later.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>expires 24h;</div><div>root /home/megasoun/public_html;</div><div>error_page  404 = @apache;</div><div>access_log /usr/local/apache/domlogs/<a href="http://mega-sound.be">mega-sound.be</a>;</div><div>log_not_found  off;  </div></div></blockquote></blockquote><div><br></div><div>Based on the rest of the config, you can probably move some of those to</div><div>"outside all locations", so that they will be inherited into all locations</div><div>that don't otherwise set them.</div><div><br></div><div><snippage></div><blockquote type="cite"><blockquote type="cite"><div><div>location / {</div><div>        proxy_pass   <a href="http://87.98.132.48:8888">http://87.98.132.48:8888</a>/;</div><div>        }</div></div></blockquote></blockquote><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>location @apache {</div><div>        proxy_pass   <a href="http://87.98.132.48:8888">http://87.98.132.48:8888</a>;</div><div>        }</div></div></blockquote></blockquote><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>include "/etc/cpnginx/custom/<a href="http://mega-sound.be">mega-sound.be</a>";</div><div>}</div></div></blockquote></blockquote><div><br></div><blockquote type="cite"><blockquote type="cite"><div>root@shadow [/usr/local/nginx/conf]# cat /etc/cpnginx/custom/<a href="http://mega-sound.be">mega-sound.be</a></div></blockquote></blockquote><div><br></div><div>As above, because this is included last in the main file, the mp3 location</div><div>here can never match.</div><div><br></div><div>So if you remove the "|mp3" up there, then this one will match:</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>location ~* \.mp3$ {</div><div>        more_set_headers 'X-MyHeader: .mp3';</div></div></blockquote></blockquote><div><br></div><div>and now you can set your types, or do whatever else is needed, and have</div><div>it take effect.</div><div><br></div><div>(If your default or server-level "root" is not correct for this location,</div><div>you'll want to set that in here too.)</div><div><br></div><div>Because of the nginx location matching rules, this next location won't</div><div>be used for /adata/123.mp3, but will be used for /adata/123.html. You can</div><div>test that by putting a file of the right name in the right ("root"/adata)</div><div>directory, and seeing the X- header appearing.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>location /adata {</div><div>        more_set_headers 'X-MyHeader: adata';</div><div>}</div></div></blockquote></blockquote><div><br></div><div>And these two are outside of all locations, so apply to everything that</div><div>does not override them.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>more_set_headers 'X-MyMasterHeader: set';</div><div>more_set_headers 'X-My2Header: $request_uri';</div></div></blockquote></blockquote><div><br></div><blockquote type="cite"><div>Here is the HTTP Headers for the root URL (<a href="http://www.mega-sound.be">www.mega-sound.be</a>):</div></blockquote><div><br></div><div>This is expected to be proxy_pass'ed to port 8888, and you can see that</div><div>your "all" more_set_headers directives did apply.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>HTTP/1.1 200 OK</div><div>X-MyMasterHeader: set</div><div>X-My2Header: /</div></div></blockquote></blockquote><div><br></div><blockquote type="cite"><div>Here is the headers for an MP3 (<a href="http://www.mega-sound.be/adata/362.mp3">http://www.mega-sound.be/adata/362.mp3</a>):</div></blockquote><div><br></div><div>This would match your original long location, so will be the file</div><div>/home/megasoun/public_html/adata/362.mp3 if it exists, and proxied to</div><div>port 8888 if it doesn't. Again, your "all" more_set_headers apply.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div><div>HTTP/1.1 200 OK</div><div>Content-Type: audio/mpeg</div><div>X-MyMasterHeader: set</div><div>X-My2Heade: /adata/362.mp3</div></div></blockquote></blockquote><div><br></div><div>If you remove "|mp3" from the first location; or just "include" this file</div><div>at the top instead of the bottom of the server{} block, then your custom</div><div>mp3 location would apply; and you should see your extra configuration</div><div>being used. (Without "root" set right, though, you may just end up with</div><div>a 404.)</div><div><br></div><div><a href="http://www.nginx.org/r/location">http://www.nginx.org/r/location</a> for the details on how nginx chooses</div><div>which one location{} block will be used for the current request, if</div><div>it's unclear.</div><div><br></div><div>All the best,</div><div><br></div><div>    f</div><div>-- </div><div>Francis Daly        <a href="mailto:francis@daoine.org">francis@daoine.org</a></div><div><br></div><div>_______________________________________________</div><div>nginx mailing list</div><div><a href="mailto:nginx@nginx.org">nginx@nginx.org</a></div><div><a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>