Apache的反向代理 - 先运行一个脚本 [英] Apache Reverse Proxy - run a script first

查看:192
本文介绍了Apache的反向代理 - 先运行一个脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用VLC和Apache反向代理一些视频内容传输实验。由于VLC可以支持HTTP流,我敢肯定,这将与Apache的反向代理工作(我没有试过,但是我不明白为什么它不会工作)。

I'm experimenting with some video content delivery using VLC and Apache Reverse Proxy. Since VLC can support http streaming, I'm sure that it will work with a Apache Reverse Proxy (I haven't tried this yet, but I don't see why it wouldn't work).

让Apache代理的HTTP视频流之前,我想先运行脚本。有没有在Apache的一个选项来做到这一点?

Before letting Apache proxy the http video stream, I would like to run a script first. Is there an option in Apache to do this?

如果不是,有人可以想办法为PHP先做一些魔法,然后莫名其妙地重定向到HTTP视频流,而不进行VLC或Windows Media Player的客户端哭了?通过做这种方式中,Apache反向代理将只需要指向只有PHP脚本。

If not, can someone think of a way for PHP to do some magic first, and then somehow redirect to the http video stream, without making a VLC or Windows Media Player client cry? By doing it this way, the Apache Reverse Proxy would just have to point to the PHP script only.

无论哪种方式,脚本的想法它启动该VLC流服务器

Either way, the idea of the script it to start the VLC streaming server.

感谢

推荐答案

如果你真的想这样做,在Apache中,你可以写自己的模块:)

if you really want to do it in apache you can always write your own module :)

另外,您可以使用 mod_rewrite的用的 PRG选项(重写地图)
在这里你基本上由外部程序处理重写规则。
你可以做任何你想做那里(日志等)。
不要忘记设置一个 rewritelock 的文件,或者你会遇到奇怪的行为。

alternatively you can use mod_rewrite with the prg option (rewrite map). where you basically have a rewrite rule processed by an external program. you can do whatever you want there (logging, etc). don't forget to set a rewritelock file, or you will experience strange behaviour.

你也可以做一切在PHP,然后使用Apache模块 mod_xsendfile ,你只传递一个头中包含的文件的locatin在文件系统中的PHP

you could also do "everything" in php and then use the apache module mod_xsendfile where you just pass a header in php containing the locatin of the file in the filesystem.

它不会被透露给客户端,但由Apache模块逮住和Apache的服务。你的PHP程序将终止regularely

it will not be disclosed to the client but catched by the apache module and served by apache. your php process will terminate regularely.

theese是最好的开箱选择我能想到的。

theese are the best out of the box options i can think of.

如果没有这个作品,因为你需要时或者在传输结束捕捉一些东西,你可能只是呼应了文件的内容用PHP。用正确的输出缓冲就可以实现在该accetable性能。

if nothing of this works because you need to catch some stuff during or at the end of the transfer you could just echo the files content with php. with correct output buffering you can achieve accetable performance on that.

或者你可以做一些日志文件后处理是否能解决您的问题。

or you could do some logfile postprocessing if this solves your problem.

这篇关于Apache的反向代理 - 先运行一个脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆