Forum: NGINX mp3 pass through?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
27d07ab5a9b0923e138819caa42e09c1?d=identicon&s=25 Ilan Berkner (Guest)
on 2009-03-03 22:59
(Received via mailing list)
Hi All,

Currently we are doing a lot of MP3 transfers on our webserver
(downloads)
and this month we exceeded our bandwidth, which is fine, but can be
costly.

We have a separate DB server that I'm thinking of off loading the MP3
traffic to, so essentially I'd like to do the following:

1. Install Nginx on DB server
2. Add rule to re-route all mp3 requests to the db server

(1) I can handle (2) I'm not sure about.  If anyone could clue me in on
how
to write the configuration rule for routing the .mp3 files that would be
great.

Thanks all!!!
Ed6583386f2b2d56e1b5eb2ee236da39?d=identicon&s=25 Nick Pearson (Guest)
on 2009-03-04 02:22
(Received via mailing list)
rewrite  ^/media/(.*\.mp3)$  http://db.domain.com/mp3s/$1  last;

If updating the code that makes these request (i.e., the website or
.swf) is
an option, then it might be better to go ahead and direct these MP3
requests
to your secondary server.  Also might be worth looking into a content
delivery network (CDN), or a basic asset host (Amazon S3 offers both).

You can find more rewrite examples here:
http://wiki.codemongers.com/NginxHttpRewriteModule#rewrite
This topic is locked and can not be replied to.