Skip to content

Latest commit

 

History

History
88 lines (61 loc) · 2.71 KB

File metadata and controls

88 lines (61 loc) · 2.71 KB

配置

初始安装 licode,仅可以从本地访问,局域网访问会报 Mixed Content 错误,需要配置证书和 public ip

证书

自签名证书

# 生成私钥
openssl genrsa > key.pem
# 生成证书
openssl req -new -x509 -key key.pem > cert.pem

Common Name需要填写本机 IP

key.pem/cert.pem替换到~/licode/cert/目录

使用 BasicExample 示例程序服务端的客户端 Tomcat 证书

keytool -genkeypair -alias "server" -keyalg "RSA" -validity "365" -keystore "server.keystore"

Common Name需要填客户端的服务端 IP

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" 
               keystoreFile="conf/server.keystore" keystorePass="xxxx"/>  

配置服务器IP、启用SSL

vim licode_config.js
// Public erizoController IP for websockets (useful when behind NATs)
// Use '' to automatically get IP from the interface
config.erizoController.publicIP = '192.168.3.185'; //default value: ''
config.erizoController.networkinterface = ''; //default value: ''

// This configuration is used by the clients to reach erizoController
// Use '' to use the public IP address instead of a hostname
config.erizoController.hostname = '192.168.3.185'; //default value: ''
config.erizoController.port = 8080; //default value: 8080
// Use true if clients communicate with erizoController over SSL
config.erizoController.ssl = true; //default value: false

// This configuration is used by erizoController server to listen for connections
// Use true if erizoController listens in HTTPS.
config.erizoController.listen_ssl = true; //default value: false
config.erizoController.listen_port = 8080; //default value: 8080

// Public erizoAgent IP for ICE candidates (useful when behind NATs)
// Use '' to automatically get IP from the interface
config.erizoAgent.publicIP = '192.168.3.185'; //default value: ''
config.erizoAgent.networkinterface = ''; //default value: ''

重启服务

配置证书、修改 licode_config.js 后需要重启 erizoController 和 示例程序

# 根据进程id关闭erizoController、basicExample
ps aux | grep node
kill <进程id>
# 启动erizoController
./erizo_controller/initErizo_controller.sh
# 启动示例程序
./scripts/initBasicExample.sh

疑难问题

/createToken 报错:连接被拒绝

证书配置有误,Common Name需要配置为服务端 IP,且需要使用 https 访问

/createToken 正常,但报 stream error

电脑摄像头或麦克风访问失败,可尝试点击Video OnlyAudio Only,或者换别的电脑尝试