centos部署janus 系列文章二 janus配置和管理


前言

这是CentOS部署Janus服务器的第二篇,我们来配置Janus让其可正常运行官方提供的demo。


提示:以下是本篇文章正文内容,涉及到另外组件的使用,博主的其它文章可供参考

一、配置

1.环境和资料准备

环境版本
CentOS(公网IP服务器)7.6
Janusv0.10.10
coturn4.5.1
Tengine (nginx)Tengine/2.3.3 , nginx/1.18.0
SSL证书crt后缀的

2.Tengine 反向代理Janus服务器

为何要在Janus之上做反向代理?Janus也能配置SSL为何还要用Nginx?
1.一般实际使用下不建议直接客户端访问Janus,通过Nginx、SLB之类的中间件我们掌握了对访问更多的控制。
同理,最佳使用还是将SSL配置到SLB上去,不要让Janus承受额外的压力。

2.1.Tengine 下载安装

wget http://tengine.taobao.org/download/tengine-2.3.3.tar.gz

tar -zxvf tengine-2.3.3.tar.gz 

cd tengine-2.3.3

./configure

make && make install

默认安装到了/usr/local/nginx目录

2.1.2 Tengine 配置

修改配置文件conf/nginx.conf

监听8089/janus 为janus RESTful API的端点
监听7889/admin 为Janus Server的管理端点

ssl_certificate和ssl_certificate_key分别为SSL证书的证书和key文件

    server {
        listen       8089 ssl;
        listen       7889 ssl;
        server_name  localhost;

        ssl_certificate /usr/local/tomcat/apache-tomcat-8.5.61/cert/demo.com_server.crt;
        ssl_certificate_key /usr/local/tomcat/apache-tomcat-8.5.61/cert/demo.com_server.key;

        ssl_session_timeout 5m;                                                                                                                                                                                                                                                                                                              
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;                                                                                                                                                                                                                                                                                                           
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;                                                                                                                                                                                                                                                                           
        ssl_prefer_server_ciphers on;                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                               
        location /janus {                                                                                                                                                      
                proxy_pass http://127.0.0.1:8088/janus;                                                                                                                                                                                                                                                          
        }                                                                                                                                                                      
                                                                                                                                                                               
        location /admin {                                                                                                                                                      
                proxy_pass http://127.0.0.1:7088/admin;                                                                                                                                                                                                                                           
                }                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                  
        error_page   500 502 503 504  /50x.html;                                                                                                                               
        location = /50x.html {                                                                                                                                                 
            root   html;                                                                                                                                                       
        }                                                                                                                                                                      

}                                                        

2.1.3 验证Tengine配置

sbin/nginx -t

输出以下日志说明配置没问题

   nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok 
   nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重载配置

sbin/nginx -s reload

检查端口监听

netstat -lnp | grep nginx

tcp        0      0 0.0.0.0:7889            0.0.0.0:*               LISTEN      3653/nginx: master  
tcp        0      0 0.0.0.0:8089            0.0.0.0:*               LISTEN      3653/nginx: master  

可以看到我们指定监听的两个端口7889、8089都已在监听了。

3.部署demo

demo文件目录在/opt/janus/share/janus/demos

Janus提供的demo就是html和js等静态文件,大家可以按自己喜好将demo放到Tomcat或者Nginx下面部署就行了。

4.配置Janus

4.1.给Janus配置ICE(turn、stun)

配置文件/opt/janus/etc/janus/janus.jcfg

janus.jcfg是Janus的核心模块配置

 nat: {
248         stun_server = "119.3.xxx.xxx"
249         stun_port = 3478
250         nice_debug = false
251         #full_trickle = true
252         #ice_lite = true
253         #ice_tcp = true
284         # credentials to authenticate...
285         turn_server = "119.3.xxx.xxx"
286         turn_port = 3478
287         turn_type = "udp"
288         turn_user = "codeboy"
289         turn_pwd = "helloworld"
290 
291         # ... or you can make use of the TURN REST API to get info on one or more 

4.2.启用管理端点

配置文件/opt/janus/etc/janus/janus.jcfg

这个是管理密码

 50         admin_secret = "janusoverlord"  # String that all Janus requests must contain

开启admin端点

配置文件在janus.transport.http.jcfg

 38 admin: {
 39         admin_base_path = "/admin"                      # Base path to bind to in the admin/monitor web server (plain HTTP only)
 40         admin_http = true                                       # Whether to enable the plain HTTP interface
 41         admin_port = 7088                                       # Admin/monitor web server HTTP port
 42         #admin_interface = "eth0"                       # Whether we should bind this server to a specific interface only
 43         #admin_ip = "192.168.0.1"                       # Whether we should bind this server to a specific IP address (v4 or v6) only
 44         admin_https = false                                     # Whether to enable HTTPS (default=false)
 45         #admin_secure_port = 7889                       # Admin/monitor web server HTTPS port, if enabled
 46         #admin_secure_interface = "eth0"        # Whether we should bind this server to a specific interface only
 47         #admin_secure_ip = "192.168.0.1         # Whether we should bind this server to a specific IP address (v4 or v6) only
 48         #admin_acl = "127.,192.168.0."          # Only allow requests coming from this comma separated list of addresses
 49 }

4.启动Janus验证配置

bin/janus

HTTP transport timer started
HTTP webserver started (port 8088, /janus path listener)...
Admin/monitor HTTP webserver started (port 7088, /admin path listener)...
JANUS REST (HTTP/HTTPS) transport plugin initialized!
Loading transport plugin 'libjanus_websockets.so'...
[WARN] libwebsockets has been built without IPv6 support, will bind to IPv4 only
libwebsockets logging: 0
WebSockets server started (port 8188)...
JANUS WebSockets transport plugin initialized!

如上,http端口8088、管理监控端口7088、WebSockets端口8188都启动了就是可以了。

5.验证

游览器访问https://mydemo.com/demos

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

到这里可知demo和Janus 管理端点没有问题。

在这里插入图片描述

在这里插入图片描述

我们使用三个客户端加入videoroom视频会话,连通之后可知ICE配置和插件功能没有问题。

至此,我们部署的Janus已经具备开发和测试的条件了。


总结

这是Janus系列文章的第二篇,主要说了怎么运行Janus提供的插件和Demo,借此来了解Janus的一些基础配置,给我们之后Janus开发奠定基础。
接下来我将更详细的给大家介绍怎么在Janus的插件的基础上进行开发。

相关文章

WebRTC 系列文章 WebRTC基本概念理解

WebRTC 系列文章 一对一视频通话和文字聊天

WebRTC 系列文章 文件共享

WebRTC 系列文章 ICE服务器搭建 coturn

WebRTC 系列文章 Janus在CentOS下安装部署

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值