建立你自己的视频社区


RH linux+ lighttpd+php5+ffmpeg+flvtool2
begin Build Your Own Video Community

一、为了能够正确安装lighttpd,需要先安装PCRE
**************************************
*PCRE
**************************************
http://www.pcre.org/

二、安装lighttpd
**************************************
*lighttpd
**************************************

1.Compiling from Source
$ gzip -cd lighttpd-1.3.15.tar.gz | tar xf -
$ cd lighttpd-1.4.11
$ ./configure
$ make
$ make install

2.init scripts :
$ sed -e 's/FOO/lighttpd/g' doc/rc.lighttpd.redhat > /etc/init.d/lighttpd
$ chmod a+rx /etc/init.d/lighttpd
$ cp -p doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
$ install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
$ chkconfig lighttpd on

3.up/down:
/etc/init.d/lighttpd start
/etc/init.d/lighttpd stop
或者
/etc/init.d/lighttpd start
/etc/init.d/lighttpd stop

4.config file:
/etc/lighttpd/lighttpd.conf
server.document-root = "/www/pages/"
server.port = 81
注意:最好为lighttpd建立一个专门的用户。

5.check config file:
$ lighttpd -t -f /etc/lighttpd/lighttpd.conf

6.start the server:
$ lighttpd -D -f /etc/lighttpd/lighttpd.conf
注意请先建立/www目录。并且制定合适的权限。

7.log file:
/www/logs/access.log
/www/logs/lighttpd.error.log

安装过程中遇到问题,可以参考这个文档。
http://trac.lighttpd.net/trac/wiki/TutorialInstallation

三、安装php5
**************************************
*php5
**************************************
install:
gunzip php-xxx.tar.gz
tar -xvf php-xxx.tar
$ ./configure --enable-fastcgi --enable-discard-path --enable-force-cgi-redirect

modify your php.ini:
cgi.fix_pathinfo=1
modify your lighttpd.conf:
1.server.modules = (
"mod_fastcgi",
)
2.fastcgi.server = ( ".php" => ((
"bin-path" => "/path/to/php-cgi",
"socket" => "/tmp/php.socket"
)))

四、安装LAME 和 ffmpeg
**************************************
*LAME
**************************************
installing:
gunzip lame-3.97.tar.gz
tar -xvf lame-3.97.tar
./configure --enable-shared --prefix=/usr
...

**************************************
*ffmpeg
**************************************
installing:

五、安装Ruby 和 flvtool2

**************************************
*Ruby
**************************************
installing:
gunzip ruby-1.8.6-p110.tar.gz
tar -xvf ruby-1.8.6-p110.tar
./configure
make
make install


**************************************
*flvtool2
**************************************
installing:
gunzip flvtool2-1.0.6.tgz
tar -xvf flvtool2-1.0.6.tgz
ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install

六、创建视频,转换成FLV格式
**************************************
*Creating Video Directories
**************************************

mkdir -p /var/videos/incoming
mkdir -p /var/videos/flv

**************************************
*Encoding Videos To FLV
**************************************
source:avi,mp4,mov,mpg,3gp,mpeg,vmv

ffmpeg -i /var/videos/incoming/video.avi -s 320x240 -ar 44100 -r 12 /var/videos/flv/video.flv

add metadata to video.flv with flvtool2:
cat /var/videos/flv/video.flv | flvtool2 -U stdin /var/videos/flv/video.flv
or
/usr/local/bin/flvtool2 -UP 9.flv

七、配置lighttpd
**************************************
*Configuring Lighttpd
**************************************
1.modify /etc/lighttpd/lighttpd.conf
server.modules = (
"mod_secdownload",
"mod_flv_streaming",
)

end:

flv-streaming.extensions = ( ".flv" )
secdownload.secret = "somesecret"
secdownload.document-root = "/var/videos/flv/"
secdownload.uri-prefix = "/dl/"
secdownload.timeout = 120

2.restart lighttpd

八、安装播放器FlowPlayer
**************************************
*FlowPlayer
**************************************

mv flowplayer /www/pages/

九、编辑测试页并运行

<?php
//一下要和lighttpd的配置文件一致
$secret = "123456";
$uri_prefix = "/dl/";

# filename
$f = "/9.flv";

# current timestamp
$t = time();

$t_hex = sprintf("%08x", $t);
$m = md5($secret.$f.$t_hex);

?>
<html>
<head>
<title>Flowplayer Test</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">

<object type="application/x-shockwave-flash" data="/flowplayer/FlowPlayerBlack.swf"
width="320" height="256" id="FlowPlayer">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/flowplayer/FlowPlayerBlack.swf" />
<param name="quality" value="high" />
<param name="scale" value="noScale" />
<param name="allowFullScreen" value="true" />
<param name="flashvars" value="config={videoFile: '<?php printf('%s%s/%s%s', $uri_prefix, $m, $t_hex, $f, $f); ?>', streamingServer: 'lighttpd', loop: 'false', useNativeFullScreen: true}" />
</object>

</body>
</html>
-----------------------------------------------------------------------
Links:
-----------------------------------------------------------------------
* Lighttpd: http://www.lighttpd.net
* mod_flv_streaming: http://blog.lighttpd.net/articles/2006/03/09/flv-streaming-with-lighttpd
* mod_secdownload: http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload
* FlowPlayer: http://flowplayer.org
* LAME: http://lame.sourceforge.net
* ffmpeg: http://ffmpeg.mplayerhq.hu
* flvtool2: http://rubyforge.org/projects/flvtool2
* PHP: http://www.php.net


参考资料:
1.Build Your Own Video Community With Lighttpd And FlowPlayer (Debian Etch)
http://www.howtoforge.com/video_streaming_lighttpd_flowplayer
2.Using Lighttpd, Mplayer/Mencoder and Flvtool2 to Implement Flash Video Streaming :: Homo-Adminus Blog by Alexey Kovyrin
http://www.clipclip.org/yaoweizhen?page=4

-----------------------------------------------------------------------
备注:
-----------------------------------------------------------------------
打开端口的命令:
iptables -A INPUT -d 目的地址 -p tcp -m tcp --dport 81 -j ACCEPT

/etc/sysconfig/iptables 文件是 iptables 守护进程调用的默认规则集文件.
可以使用以下命令保存执行过的IPTABLES命令:
/sbin/iptables-save > /etc/sysconfig/iptables
参考iptables
http://zhidao.baidu.com/question/37749857.html

建立自己的技术社区是一个长期但非常有价值的过程,既能巩固个人影响力,又能促进技术交流。以下是分步骤的实践指南: ### 一、社区定位设计 1. **垂直领域选择**(例): - 细分方向:Web3前端开发/LLM应用工程/Rust嵌入式 - 差异化定位:「智能合约安全审计」社区 vs 普通区块链社区 2. **用户分层策略**: ```mermaid graph TD A[核心用户] -->|输出内容| B(资深开发者) C[活跃用户] -->|提问互动| B D[潜在用户] -->|学习资源| C ``` ### 二、基础建设阶段 1. **平台选型组合**: - 即时交流:Discord(技术频道+机器人管理) - 内容沉淀:GitHub Wiki + 自建博客 - 活动组织:Zoom(线上会议)+ Meetup(线下) 2. **自动化工具链**: ```python # 示例:用GitHub Actions自动同步内容 name: Update Community Content on: schedule: - cron: '0 12 * * *' # 每天UTC时间12点 jobs: sync: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: python sync_to_discord.py # 自定义同步脚本 ``` ### 三、冷启动运营方案 1. **种子用户获取**: - 从个人博客/视频的读者中转化 - 在Stack Overflow回答问题时附带邀请 - 技术大会后收集参会者联系方式 2. **激励体系设计**: | 等级 | 权益 | 达成条件 | |------------|--------------------------|-----------------------| | 萌新 | 基础问答权限 | 完成邮箱验证 | | 贡献者 | 专属技术评审通道 | 提交3个PR | | 核心成员 | 参与roadmap制定 | 组织过2次线上分享 | ### 四、持续运营关键点 1. **内容质量控制**: - 设立「每周技术雷达」专栏 - 实施Peer Review机制(类似开源项目) 2. **防衰退措施**: - 每月「技术债清理日」 - 核心成员轮值制度 3. **商业化路径**: - 阶梯式赞助方案(从$5/月的个人赞助到企业级合作) - 技术咨询服务抽成(社区作为对接平台) ### 五、成功案例参考 - Vue.js早期通过GitHub Issues建立讨论文化 - Rust语言社区的「This Week in Rust」运营模式 - 国内掘金社区从微信群到独立App的演进
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值