标签:ati form 视频 master passwd module rtm forward usr
如果服务器处于内网或者没有公网ip,可以使用 相关软件进行打洞或转发 如: frpc
https://github.com/fatedier/frp 或 holer
https://github.com/wisdom-projects/holer
服务器中有很多视频,有时候在外面想要看些视频的时候就有些麻烦了.可以通过http共享然后使用vlc之类播放器播放.但是需要自制播放列表很是麻烦.
使用nginx_rtmp_module
查件可以实现 直接从目录方式访问点击视频就可以播放的效果.
所以nginx是必要的.而且要源码编译,编译时候要加上nginx_rtmp_module
这个模块.
必要的编译包自行安装.gcc之类还有一些依赖包
wget http://nginx.org/download/nginx-1.16.0.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar xf nginx-1.16.0.tar.gz
unzip master.zip
cd nginx-1.16.0
mv * ../
cd ..
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
make -j4
make install
至此nginx编译安装完成.
vim /usr/local/nginx/conf/nginx.conf
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
application vod {
play /mnt/s2t; #这是一个目录的名称,如果是linux,则写具体位置如/opt/video
}
}
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 8080;
server_name localhost;
charset utf8;
#access_log logs/host.access.log main;
location / {
root /mnt/s2t;
autoindex on;
auth_basic "needAuth";
auth_basic_user_file /usr/local/nginx/conf/passwd.db;
index index.html index.htm;
}
location /test.flv {
root video;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
}
htpasswd -c /usr/local/nginx/conf/passwd.db makeit
/usr/local/nginx/sbin/nginx -s reload
右键支持倍速播放哦.
参考:
关于模块更多信息
https://github.com/arut/nginx-rtmp-module
标签:ati form 视频 master passwd module rtm forward usr
原文地址:https://www.cnblogs.com/lovesKey/p/11027348.html