J
J
jemand2013-11-25 11:16:49
Audio broadcast
jemand, 2013-11-25 11:16:49

How to properly distribute free and paid audio lessons on Wirth. hosting (so as not to fill it up)?

Good afternoon. Need advice. There will be a small site, traffic is small: the question is quite specific. There is a need to distribute audio in addition to text materials (speech, small files - well, megabytes, in the cr. case, tens of megabytes). Audio will be distributed mostly free and freely. But I would like to count how many times what was downloaded in order to evaluate user preferences.
There is also an intention to eventually start taking a small amount of money for new audio lessons, after some time, laying them out for free access.
The site will be on a regular virtual hosting. There will be practically no other load besides distributing such files, so I would not want to switch to VDS. But, accordingly, you cannot put anything additional, for example, mod_xsendfile for Apache, so that he distributes files himself.
How to give a file through PHP I represent. But experienced people on Habré say that several is enough. clients with a slow link to cause the site to stop responding. Therefore it is necessary to take out files somewhere.
How do you do things like this right? So far I have this idea. Upload free files to the cloud or some kind of file hosting. To count how many downloads, however, I can only relatively, since someone can simply publish a direct link to the file. Well, I'll get an estimate from below - how many times I have clicked on the "download" or "play" button. But I probably won’t be able to organize paid access then? According to kr. least I don't know how.
Then pay access only through your site, directly giving the file through readfile (). Well, see what happens to the site at the same time, whether it falls.
But maybe there are some better ways?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mandor, 2013-11-25
@jemand

* For mass distribution of heavy content, you need to use a lightweight server like nginx. The idea is that they will not eat up a lot of memory when there are a lot of parallel clients.
* If nginx (or similar) cannot be used, let Apache do it, but definitely not through php.
* Let php deal with authentication and other management, and as a result, it simply creates a symlink to the desired file, which is then downloaded directly from the http server (including using X-Accel-Redirect, if you suddenly have such an opportunity).
* Storing files on an external resource is a good idea. But it is not clear how you will calculate the statistics and receive money. Of course, you can do there, for example, automatic generation of complex links, and you will generate them on your site according to the same algorithm and give them to whomever you need, taking into account statistics, but then it’s not clear why you can’t immediately be placed on that remote external storage.
* Paid access via readfile is a bad idea (see above).
* If you still decide to give content through php, be sure to implement resending (if you can’t, it’s better not to take it), you can read the info for example here http://habrahabr.ru/post/138504/ .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question