( http://blog.csdn.net/quqi99 )
将家中电脑上的mp4视频通过网页下载及播放。
电脑上可以通过右键另存为直接下载视频,手机触摸屏无右键可在播放器播放时点击下载按钮下载。
sudo apt-get install libpcre3 libpcre3-dev libssl-dev openssl
wget http://nginx.org/download/nginx-1.10.1.tar.gz
tar -xf nginx-1.10.1.tar.gz
cd nginx-1.10.1/
./configure --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --with-debug
make && sudo make install
vi /usr/local/nginx/conf/nginx.conf
location ~ \.mp4$ {
mp4;
limit_rate 2m;
}
sudo mv *.mp4 /usr/local/nginx/html/
sudo /usr/local/nginx/sbin/nginx
#sudo /usr/local/nginx/sbin/nginx -s reload
cat /usr/local/nginx/html/index.html
<html>
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to our world!</title>
<style>
@media screen and (max-device-width: 480px) {
}
</style>
</head>
<body>
<p> <a href="test.mp4">右键另存为下载</a> </p>
<video id="sampleMovie" width="356" height="200" controls poster="test.jpg">
<source src="test.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
</video>
</body>
</html>