caching - Forcing user's browser to save files to cache -
my website online music portal online playing system.
when user play song, served nginx server on port 8080 on server.
the problem when song has finished playing, player repeats song. every time replays, makes call server , starts downloading file again play.
previously had apache serve these files. @ time, user requested file once , replays played cache. how can achieve using nginx
[i not using script php or serve file. it's direct link. http://www.myserver.com:8080/music/song1.mp3]
it lot see of former apache configuration , current nginx configuration see how they're set put expiration headers on outbound files. isn't foolproof way enforce caching, may know, sounds "good enough" work you. try nginx configuration block within server{}
block reads this:
location ~* \.(mp3)$ { expires max; }
that should set far-future expiration date on files , encourage browser cache them longer.
Comments
Post a Comment