Discuz! Board

标题: 重新按照规范,配置一次apprtc [打印本页]

作者: zangcf    时间: 2016-8-9 22:36
标题: 重新按照规范,配置一次apprtc
1,所有需要的东西,都现下载
2,每次尽量测试

作者: zangcf    时间: 2016-8-9 22:47
标题: 第一步,按照node.js环境
本帖最后由 zangcf 于 2016-8-10 06:18 编辑

参考https://github.com/webrtc/apprtc

nstall grunt by first installing npm. npm is distributed as part of nodejs.

sudo apt-get install nodejs
sudo npm install -g npm-->这一步时间非常长,可能和nodejs的网络有关系

On Ubuntu 14.04 the default packages installs /usr/bin/nodejs but the /usr/bin/node executable is required for grunt. This is installed on some Ubuntu package sets; if it is missing, you can add this by installing the nodejs-legacy package,

sudo apt-get install nodejs-legacy

It is easiest to install a shared version of grunt-cli from npm using the -g flag. This will allow you access the gruntcommand from /usr/local/bin. More information can be found on gruntjs Getting Started.

sudo npm -g install grunt-cli
全部完成之后,做一次磁盘快照



作者: zangcf    时间: 2016-8-10 06:31
标题: 准备apprtc的代码
本帖最后由 zangcf 于 2016-8-10 16:08 编辑

1,安装git
  1. apt-get install git-core
复制代码
2,同步代码
  1. git clone https://github.com/webrtc/apprtc.git apprtc_root
复制代码
3, 进入apprtc_root目录,安装依赖库
  1. npm install
复制代码
等待同步完成之后,进行一次快照

上面的方法一直是失败的,因此,我们需要一台翻墙的机器,同步完代码之后,打包上传到云端


作者: zangcf    时间: 2016-8-10 16:23
标题: 本地下载转运方式准备apprtc代码
本帖最后由 zangcf 于 2016-8-10 16:54 编辑

1,首先,准备VPN,保证google可以顺利上2,下载代码
  1. git clone https://github.com/webrtc/apprtc.git apprtc_root
复制代码

3,安装需求包
  1. npm install
复制代码
4, 编译代码
  1. grunt build
复制代码
5, 打包上传到服务起,然后执行34步动作
服务器段执行环境缺少java执行环境,安装openjdk
sudo apt-get install openjdk-7-jdk

建立快照

作者: zangcf    时间: 2016-8-10 17:54
本帖最后由 zangcf 于 2016-8-10 18:19 编辑

google_appengine的开发环境准备
下载/media/ultranix/windows/windowsxpsharedata/swap/91xp/google_appengine_1.9.35.zip,push到服务器
解压缩

运行:

打开火狐浏览器,输入http://120.76.203.222:8080/可以链接但是没有内容但是windows下面的火狐是ok的

使用chrome浏览器可以看到登录界面写一个房间服务器的批处理:
export PATH=$PATH:$HOME/google_appengineexport APPRTC_APP=$HOME/apprtc_root/out/app_engine/export HOST="--host=0.0.0.0"export ICE_SERVER_API_KEY="AIzaSyAJdh2HkajseEIltlZ3SIXO02Tze9sO3NY"dev_appserver.py $HOST $APPRTC_APP


作者: zangcf    时间: 2016-8-10 18:28
标题: 安装nginx的https的反向代理
本帖最后由 zangcf 于 2016-8-10 19:06 编辑

准备ssl的Key和crt文件
  1. root@iZ949sqo4m3Z:~/singalserver# ls
  2. signalmaster-master  signalmaster-master.zip  test
  3. root@iZ949sqo4m3Z:~/singalserver# cd signalmaster-master/
  4. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls
  5. config      LICENSE       package.json  README.md  server.js   test.js
  6. Dockerfile  node_modules  Procfile      scripts    sockets.js
  7. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# cd ..
  8. root@iZ949sqo4m3Z:~/singalserver# ls
  9. signalmaster-master  signalmaster-master.zip  test
  10. root@iZ949sqo4m3Z:~/singalserver# cd signalmaster-master/
  11. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls
  12. config      LICENSE       package.json  README.md  server.js   test.js
  13. Dockerfile  node_modules  Procfile      scripts    sockets.js
  14. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ./scripts/generate-ssl-certs.sh
  15. Generating self-signed certificates...
  16. Generating RSA private key, 1024 bit long modulus
  17. ..........++++++
  18. ..........++++++
  19. e is 65537 (0x10001)
  20. You are about to be asked to enter information that will be incorporated
  21. into your certificate request.
  22. What you are about to enter is what is called a Distinguished Name or a DN.
  23. There are quite a few fields but you can leave some blank
  24. For some fields there will be a default value,
  25. If you enter '.', the field will be left blank.
  26. -----
  27. Country Name (2 letter code) [AU]:CN
  28. State or Province Name (full name) [Some-State]:GD
  29. Locality Name (eg, city) []:SZ
  30. Organization Name (eg, company) [Internet Widgits Pty Ltd]:91xuepai
  31. Organizational Unit Name (eg, section) []:91xuepai
  32. Common Name (e.g. server FQDN or YOUR name) []:91xuepai
  33. Email Address []:710833814@qq.com

  34. Please enter the following 'extra' attributes
  35. to be sent with your certificate request
  36. A challenge password []:123456
  37. An optional company name []:91xuepai
  38. Signature ok
  39. subject=/C=CN/ST=GD/L=SZ/O=91xuepai/OU=91xuepai/CN=91xuepai/emailAddress=710833814@qq.com
  40. Getting Private key
  41. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master#
复制代码


第二步,安装nginx
  1. apt-get install nginx
复制代码
第三步,配置反向代理站点
  1. #/etc/nginx/sites-enabled/apprtc.91xuepai.com
  2. upstream roomserver {
  3.         server localhost:8080;
  4. }


  5. server {
  6.         listen 80 ;
  7.         server_name 91xuepai.com;
  8.         return  301 https://$server_name$request_uri;
  9. }

  10. server {
  11.         listen 443 ;
  12.         ssl on;
  13.         # 域名为apprtc.diveinedu.com的SSL证书文件
  14.         ssl_certificate      /etc/nginx/apprtc.91xuepai.com.crt;
  15.         ssl_certificate_key  /etc/nginx/apprtc.91xuepai.com.key;

  16.         server_name apprtc.91xuepai.com;
  17.         access_log  /var/log/nginx/apprtc.91xuepai.com.log;
  18.         location / {
  19.                 proxy_pass http://roomserver$request_uri;
  20.                 proxy_set_header Host $host;
  21.         }

  22. }
复制代码


测试,反向代理失败了。为什么?




作者: zangcf    时间: 2016-8-10 19:58
恢复快照
使用我下载完全的nginx.tar.gz包,push到服务器上面
第一步,compile and intall pcre
  1. cd pcre-8.32/
  2. ./configure --prefix=/usr/local/pcre
  3. make
  4. make install
复制代码
第二步,配置编译nginx
首先,打开文件/usr/bin/pod2man
注释掉第71行
接着,设定配置选项
  1. ./configure  --with-pcre=../pcre-8.32 --with-http_ssl_module --with-zlib=../zlib/1.2.3  --prefix=/usr/local/nginx --with-http_stub_status_module --with-cc-opt='-O3' --with-openssl=../openssl-1.0.1f
复制代码
修改C语言编译规则,修改为
  1. CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-func
  2. tion -Wunused-variable -Wunused-value -g -O3
复制代码
编译安装
  1. make
  2. make install
复制代码
第三步,生成sll的key和crt文件
利用simplewebrtc的信令服务的源码singlemaster去生成该文件
把信令服务器的源码不是到服务器上,或者下载
生成过程:
  1. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ./scripts/generate-ssl-certs.sh
  2. Generating self-signed certificates...
  3. Generating RSA private key, 1024 bit long modulus
  4. ............................++++++
  5. .........................++++++
  6. e is 65537 (0x10001)
  7. You are about to be asked to enter information that will be incorporated
  8. into your certificate request.
  9. What you are about to enter is what is called a Distinguished Name or a DN.
  10. There are quite a few fields but you can leave some blank
  11. For some fields there will be a default value,
  12. If you enter '.', the field will be left blank.
  13. -----
  14. Country Name (2 letter code) [AU]:CN
  15. State or Province Name (full name) [Some-State]:GD
  16. Locality Name (eg, city) []:SZ
  17. Organization Name (eg, company) [Internet Widgits Pty Ltd]:91xuepai
  18. Organizational Unit Name (eg, section) []:91xuepai
  19. Common Name (e.g. server FQDN or YOUR name) []:91xuepai
  20. Email Address []:710833814@qq.com

  21. Please enter the following 'extra' attributes
  22. to be sent with your certificate request
  23. A challenge password []:123456
  24. An optional company name []:91xuepai
  25. Signature ok
  26. subject=/C=CN/ST=GD/L=SZ/O=91xuepai/OU=91xuepai/CN=91xuepai/emailAddress=710833814@qq.com
  27. Getting Private key
  28. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls ./config/sslcerts/
  29. cert.pem  key.pem
  30. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master#
复制代码


第四步,修改nginx的配置文件
  1. add include /etc/nginx/sites-enabled/*; in http{}
复制代码

手工建立站点文件
  1. mkdir -p /etc/nginx/sites-enabled
复制代码
建立/etc/nginx/sites-enabled/apprtc.91xuepai.com文件
  1. #/etc/nginx/sites-enabled/apprtc.91xuepai.com
  2. upstream roomserver {
  3.         server localhost:8080;
  4. }


  5. server {
  6.         listen 80 ;
  7.         server_name apprtc.91xuepai.com;
  8.         return  301 https://$server_name$request_uri;
  9. }

  10. server {
  11.         listen 443 ;
  12.         ssl on;
  13.         # 域名为apprtc.diveinedu.com的SSL证书文件
  14.         ssl_certificate      /etc/nginx/apprtc.91xuepai.com.crt;
  15.         ssl_certificate_key  /etc/nginx/apprtc.91xuepai.com.key;

  16.         server_name apprtc.91xuepai.com;
  17.         access_log  /var/log/nginx/apprtc.91xuepai.com.log;
  18.         location / {
  19.                 proxy_pass http://roomserver$request_uri;
  20.                 proxy_set_header Host $host;
  21.         }

  22. }
复制代码
拷贝sll key到/etc/nginx/下
  1. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts# cp cert.pem /etc/nginx/apprtc.91xuepai.com.crt
  2. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts# cp key.pem /etc/nginx/apprtc.91xuepai.com.key
  3. root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts#
复制代码
nginx的配置文件如下:

  1. #user  nobody;
  2. worker_processes  1;

  3. #error_log  logs/error.log;
  4. #error_log  logs/error.log  notice;
  5. #error_log  logs/error.log  info;

  6. #pid        logs/nginx.pid;


  7. events {
  8.     worker_connections  1024;
  9. }


  10. http {
  11.     include       mime.types;
  12.     default_type  application/octet-stream;

  13.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  14.     #                  '$status $body_bytes_sent "$http_referer" '
  15.     #                  '"$http_user_agent" "$http_x_forwarded_for"';

  16.     #access_log  logs/access.log  main;

  17.     sendfile        on;
  18.     #tcp_nopush     on;

  19.     #keepalive_timeout  0;
  20.     keepalive_timeout  65;

  21.     #gzip  on;

  22.     server {
  23.         listen       80;
  24.         server_name  localhost;

  25.         #charset koi8-r;

  26.         #access_log  logs/host.access.log  main;

  27.         location / {
  28.             root   html;
  29.             index  index.html index.htm;
  30.         }

  31.         #error_page  404              /404.html;

  32.         # redirect server error pages to the static page /50x.html
  33.         #
  34.         error_page   500 502 503 504  /50x.html;
  35.         location = /50x.html {
  36.             root   html;
  37.         }

  38.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  39.         #
  40.         #location ~ \.php$ {
  41.         #    proxy_pass   http://127.0.0.1;
  42.         #}

  43.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  44.         #
  45.         #location ~ \.php$ {
  46.         #    root           html;
  47.         #    fastcgi_pass   127.0.0.1:9000;
  48.         #    fastcgi_index  index.php;
  49.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  50.         #    include        fastcgi_params;
  51.         #}

  52.         # deny access to .htaccess files, if Apache's document root
  53.         # concurs with nginx's one
  54.         #
  55.         #location ~ /\.ht {
  56.         #    deny  all;
  57.         #}
  58.     }

  59.     include /etc/nginx/sites-enabled/*;

  60.     # another virtual host using mix of IP-, name-, and port-based configuration
  61.     #
  62.     #server {
  63.     #    listen       8000;
  64.     #    listen       somename:8080;
  65.     #    server_name  somename  alias  another.alias;

  66.     #    location / {
  67.     #        root   html;
  68.     #        index  index.html index.htm;
  69.     #    }
  70.     #}


  71.     # HTTPS server
  72.     #
  73.     #server {
  74.     #    listen       443;
  75.     #    server_name  localhost;

  76.     #    ssl                  on;
  77.     #    ssl_certificate      cert.pem;
  78.     #    ssl_certificate_key  cert.key;

  79.     #    ssl_session_timeout  5m;

  80.     #    ssl_protocols  SSLv2 SSLv3 TLSv1;
  81.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  82.     #    ssl_prefer_server_ciphers   on;

  83.     #    location / {
  84.     #        root   html;
  85.     #        index  index.html index.htm;
  86.     #    }
  87.     #}

  88. }
复制代码


重启nginx

OK
开始快照

作者: zangcf    时间: 2016-8-11 10:33
标题: 准备信令服务器
本帖最后由 zangcf 于 2016-8-11 10:34 编辑

因为go环境和collider的下载编译都需要翻墙,因为现在本地同步好,然后上传到云服务器
第一步,准备go环境
解压go包
  1. root@iZ949sqo4m3Z:~# tar xzvf go1.6.2.linux-amd64.tar.gz
复制代码

建立go工作目录
  1. mkdir -p $HOME/gopath/src
复制代码
修改环境文件.profile
  1. export GOROOT=$HOME/go
  2. export GOPATH=$HOME/gopath
  3. export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
复制代码
第二步,准备信令服务器源码
解压collider_root文件,然后copy到gopath下面
  1. root@iZ949sqo4m3Z:~# cp -r collider_root/src/* gopath/src/
复制代码


第三步修改源码:
编辑$GOPATH/src/collidermain/main.go,修改房间服务器为我们前面的房间服务器:
  1. var roomSrv = flag.String("room-server", "https://120.76.203.222", "The origin of the room server")
复制代码
修改https的证书,位置在
  1. root@iZ949sqo4m3Z:~# ls /etc/nginx/
  2. apprtc.91xuepai.com.crt  cert.pem  sites-enabled
  3. apprtc.91xuepai.com.key  key.pem
复制代码
修改文件$GOPATH/src/collider/collider.go
  1.                 e = server.ListenAndServeTLS("/etc/nginx/cert.pem", "/etc/nginx/key.pem")
复制代码
第四步,安装信令服务器
  1. root@iZ949sqo4m3Z:~# go get collidermain
  2. root@iZ949sqo4m3Z:~# go install collidermain
复制代码
第五步,运行信令服务器
  1. root@iZ949sqo4m3Z:~# $GOPATH/bin/collidermain -port=8089 -tls=true
  2. 2016/08/11 10:32:17 Starting collider: tls = true, port = 8089, room-server=https://120.76.203.222
  3. 2016/08/11 10:32:17 Run: http2: TLSConfig.CipherSuites index 4 contains an HTTP/2-approved cipher suite (0xc030), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.
复制代码

如何测试信令服务器是否OK呢?创建快照




作者: zangcf    时间: 2016-8-11 11:02
标题: 配置穿墙服务器
本帖最后由 zangcf 于 2016-8-11 11:29 编辑

下载版本:
  1. wget http://turnserver.open-sys.org/downloads/v4.4.1.2/turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
复制代码
解压缩:
  1. root@iZ949sqo4m3Z:~/turnserver# tar xzvf turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
  2. INSTALL
  3. coturn_4.4.1.2-1_amd64.deb
  4. root@iZ949sqo4m3Z:~/turnserver# ls
  5. coturn_4.4.1.2-1_amd64.deb
  6. INSTALL
  7. turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
  8. root@iZ949sqo4m3Z:~/turnserver#
复制代码
安装
  1. root@iZ949sqo4m3Z:~/turnserver# dpkg -i coturn_4.4.1.2-1_amd64.deb
  2. Selecting previously unselected package coturn.
  3. (Reading database ... 126517 files and directories currently installed.)
  4. Preparing to unpack coturn_4.4.1.2-1_amd64.deb ...
  5. Unpacking coturn (4.4.1.2-1) ...
  6. dpkg: dependency problems prevent configuration of coturn:
  7. coturn depends on libevent-core-2.0-5 (>= 2.0.10-stable); however:
  8.   Package libevent-core-2.0-5 is not installed.
  9. coturn depends on libevent-extra-2.0-5 (>= 2.0.10-stable); however:
  10.   Package libevent-extra-2.0-5 is not installed.
  11. coturn depends on libevent-openssl-2.0-5 (>= 2.0.10-stable); however:
  12.   Package libevent-openssl-2.0-5 is not installed.
  13. coturn depends on libevent-pthreads-2.0-5 (>= 2.0.10-stable); however:
  14.   Package libevent-pthreads-2.0-5 is not installed.
  15. coturn depends on libhiredis0.10 (>= 0.10.1); however:
  16.   Package libhiredis0.10 is not installed.
  17. coturn depends on libmysqlclient18 (>= 5.5.24+dfsg-1); however:
  18.   Package libmysqlclient18 is not installed.
  19. coturn depends on libpq5 (>= 8.4~); however:
  20.   Package libpq5 is not installed.

  21. dpkg: error processing package coturn (--install):
  22. dependency problems - leaving unconfigured
  23. Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
  24. Processing triggers for ureadahead (0.100.0-16) ...
  25. ureadahead will be reprofiled on next reboot
  26. Processing triggers for ufw (0.34~rc-0ubuntu2) ...
  27. Errors were encountered while processing:
  28. coturn
  29. root@iZ949sqo4m3Z:~/turnserver# apt-get install -f
  30. Reading package lists... Done
  31. Building dependency tree      
  32. Reading state information... Done
  33. Correcting dependencies... Done
  34. The following extra packages will be installed:
  35.   libevent-core-2.0-5 libevent-extra-2.0-5 libevent-openssl-2.0-5
  36.   libevent-pthreads-2.0-5 libhiredis0.10 libmysqlclient18 libpq5 mysql-common
  37. The following NEW packages will be installed:
  38.   libevent-core-2.0-5 libevent-extra-2.0-5 libevent-openssl-2.0-5
  39.   libevent-pthreads-2.0-5 libhiredis0.10 libmysqlclient18 libpq5 mysql-common
  40. 0 upgraded, 8 newly installed, 0 to remove and 77 not upgraded.
  41. 1 not fully installed or removed.
  42. Need to get 865 kB of archives.
  43. After this operation, 4,484 kB of additional disk space will be used.
  44. Do you want to continue? [Y/n] y
  45. Get:1 http://mirrors.aliyun.com/ubuntu/ trusty-security/main libevent-core-2.0-5 amd64 2.0.21-stable-1ubuntu1.14.04.1 [78.3 kB]
  46. Get:2 http://mirrors.aliyun.com/ubuntu/ trusty-security/main libevent-extra-2.0-5 amd64 2.0.21-stable-1ubuntu1.14.04.1 [57.8 kB]
  47. Get:3 http://mirrors.aliyun.com/ubuntu/ trusty-security/main libevent-openssl-2.0-5 amd64 2.0.21-stable-1ubuntu1.14.04.1 [12.6 kB]
  48. Get:4 http://mirrors.aliyun.com/ubuntu/ trusty-security/main libevent-pthreads-2.0-5 amd64 2.0.21-stable-1ubuntu1.14.04.1 [6,126 B]
  49. Get:5 http://mirrors.aliyun.com/ubuntu/ trusty/universe libhiredis0.10 amd64 0.11.0-3 [23.5 kB]
  50. Get:6 http://mirrors.aliyun.com/ubuntu/ trusty-security/main mysql-common all 5.5.50-0ubuntu0.14.04.1 [12.9 kB]
  51. Get:7 http://mirrors.aliyun.com/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.50-0ubuntu0.14.04.1 [595 kB]
  52. Get:8 http://mirrors.aliyun.com/ubuntu/ trusty-updates/main libpq5 amd64 9.3.13-0ubuntu0.14.04 [78.6 kB]
  53. Fetched 865 kB in 0s (1,212 kB/s)
  54. Selecting previously unselected package libevent-core-2.0-5:amd64.
  55. (Reading database ... 126619 files and directories currently installed.)
  56. Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-1ubuntu1.14.04.1_amd64.deb ...
  57. Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  58. Selecting previously unselected package libevent-extra-2.0-5:amd64.
  59. Preparing to unpack .../libevent-extra-2.0-5_2.0.21-stable-1ubuntu1.14.04.1_amd64.deb ...
  60. Unpacking libevent-extra-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  61. Selecting previously unselected package libevent-openssl-2.0-5:amd64.
  62. Preparing to unpack .../libevent-openssl-2.0-5_2.0.21-stable-1ubuntu1.14.04.1_amd64.deb ...
  63. Unpacking libevent-openssl-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  64. Selecting previously unselected package libevent-pthreads-2.0-5:amd64.
  65. Preparing to unpack .../libevent-pthreads-2.0-5_2.0.21-stable-1ubuntu1.14.04.1_amd64.deb ...
  66. Unpacking libevent-pthreads-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  67. Selecting previously unselected package libhiredis0.10:amd64.
  68. Preparing to unpack .../libhiredis0.10_0.11.0-3_amd64.deb ...
  69. Unpacking libhiredis0.10:amd64 (0.11.0-3) ...
  70. Selecting previously unselected package mysql-common.
  71. Preparing to unpack .../mysql-common_5.5.50-0ubuntu0.14.04.1_all.deb ...
  72. Unpacking mysql-common (5.5.50-0ubuntu0.14.04.1) ...
  73. Selecting previously unselected package libmysqlclient18:amd64.
  74. Preparing to unpack .../libmysqlclient18_5.5.50-0ubuntu0.14.04.1_amd64.deb ...
  75. Unpacking libmysqlclient18:amd64 (5.5.50-0ubuntu0.14.04.1) ...
  76. Selecting previously unselected package libpq5.
  77. Preparing to unpack .../libpq5_9.3.13-0ubuntu0.14.04_amd64.deb ...
  78. Unpacking libpq5 (9.3.13-0ubuntu0.14.04) ...
  79. Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  80. Setting up libevent-extra-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  81. Setting up libevent-openssl-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  82. Setting up libevent-pthreads-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.1) ...
  83. Setting up libhiredis0.10:amd64 (0.11.0-3) ...
  84. Setting up mysql-common (5.5.50-0ubuntu0.14.04.1) ...
  85. Setting up libmysqlclient18:amd64 (5.5.50-0ubuntu0.14.04.1) ...
  86. Setting up libpq5 (9.3.13-0ubuntu0.14.04) ...
  87. Setting up coturn (4.4.1.2-1) ...
  88. Adding group `turnserver' (GID 115) ...
  89. Done.
  90. Adding system user `turnserver' (UID 106) ...
  91. Adding new user `turnserver' (UID 106) with group `turnserver' ...
  92. Not creating home directory `/'.
  93. * coturn disabled in /etc/default/coturn turnserver
  94.    ...done.
  95. * See /etc/default/coturn for instructions on enabling turnserver
  96.    ...done.
  97. Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
  98. Processing triggers for ureadahead (0.100.0-16) ...
  99. Processing triggers for ufw (0.34~rc-0ubuntu2) ...
  100. root@iZ949sqo4m3Z:~/turnserver#
复制代码
编辑配置文件,打开系统默认启动配置:
  1. # Uncomment it if you want to have the turnserver running as
  2. # an automatic system service daemon
  3. #
  4. TURNSERVER_ENABLED=1

  5. "/etc/default/coturn" 6L, 125C written         
复制代码


把上面打开编辑的文件中的这一行TURNSERVER_ENABLED=1去掉注释,保存退出.
准备用户名,域名和密码
用户名:91xuepai
域名:91xuepai
密码:91xuepai
  1. root@iZ949sqo4m3Z:~/turnserver# turnadmin -k -u 91xuepai -p 91xuepai -r 91xuepai
  2. 0x696abf1163c64258bd58039c6c70fe00
  3. root@iZ949sqo4m3Z:~/turnserver#
复制代码

修改/etc/turnserver.conf
  1. listening-device=eth1
  2. listening-port=3478
  3. tls-listening-port=5349
  4. listening-ip=120.76.203.222
  5. relay-device=eth1
  6. relay-ip=120.76.203.222
  7. Verbose
  8. fingerprint
  9. lt-cred-mech
  10. use-auth-secret
  11. static-auth-secret=91xuepai
复制代码

  1. user=91xuepai:91xuepai
  2. user=91xuepai:0x696abf1163c64258bd58039c6c70fe00
  3. realm=91xuepai.com
  4. stale-nonce
  5. cert=/etc/nginx/cert.pem
  6. pkey=/etc/nginx/key.pem
  7. no-loopback-peers
  8. sha256
  9. mobility
  10. no-cli
复制代码
启动穿墙服务器

  1. root@iZ949sqo4m3Z:~/turnserver# service coturn start
  2. * Starting coturn  turnserver
  3. 0: log file opened: /var/log/turn_24506_2016-08-11.log
  4. 0:
  5. RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
  6. Version Coturn-4.4.1.2 'Ardee West'
  7. 0:
  8. Max number of open files/sockets allowed for this process: 65535
  9. 0:
  10. Due to the open files/sockets limitation,
  11. max supported number of TURN Sessions possible is: 32500 (approximately)
  12. 0:

  13. ==== Show him the instruments, Practical Frost: ====

  14. 0: TLS supported
  15. 0: DTLS supported
  16. 0: AEAD supported
  17. 0: SQLite supported, default database location is /var/lib/turn/turndb
  18. 0: Redis supported
  19. 0: PostgreSQL supported
  20. 0: MySQL supported
  21. 0: MongoDB is not supported
  22. 0: OpenSSL compile-time version: OpenSSL 1.0.1e 11 Feb 2013
  23. 0: Default Net Engine version: 2 (UDP thread per network endpoint)

  24. =====================================================

  25. 0: Listener address to use: 120.76.203.222
  26. 0: Relay address to use: 120.76.203.222
  27. 0: Domain name:
  28. 0: Default realm: 91xuepai.com
  29. 0: SSL23: Certificate file found: /etc/nginx/cert.pem
  30. 0: SSL23: Private key file found: /etc/nginx/key.pem
  31. 0: TLS1.0: Certificate file found: /etc/nginx/cert.pem
  32. 0: TLS1.0: Private key file found: /etc/nginx/key.pem
  33. 0: TLS1.1: Certificate file found: /etc/nginx/cert.pem
  34. 0: TLS1.1: Private key file found: /etc/nginx/key.pem
  35. 0: TLS1.2: Certificate file found: /etc/nginx/cert.pem
  36. 0: TLS1.2: Private key file found: /etc/nginx/key.pem
  37. 0: TLS cipher suite: DEFAULT
  38. 0: DTLS: Certificate file found: /etc/nginx/cert.pem
  39. 0: DTLS: Private key file found: /etc/nginx/key.pem
  40. 0: DTLS cipher suite: DEFAULT
  41.    ...done.
  42. root@iZ949sqo4m3Z:~/turnserver#
复制代码
建立系统快照

作者: zangcf    时间: 2016-8-11 11:41
标题: 系统综合配置
1,修改房间的ICE配置
  1. ROOM_MEMCACHE_EXPIRATION_SEC = 60 * 60 * 24
  2. MEMCACHE_RETRY_LIMIT = 100

  3. LOOPBACK_CLIENT_ID = 'LOOPBACK_CLIENT_ID'

  4. # TODO: Remove once clients support ICE_SERVER.
  5. TURN_BASE_URL = 'https://120.76.203.222'
  6. TURN_URL_TEMPLATE = '%s/turn.php?username=%s&key=%s'
  7. CEOD_KEY = '91xuepai'

  8. ICE_SERVER_BASE_URL = 'https://120.76.203.222'
  9. ICE_SERVER_URL_TEMPLATE = '%s/apprtc/iceconfig.php?key=%s'
  10. ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
复制代码
2,重新build一次
  1. root@iZ949sqo4m3Z:~/apprtc_root# grunt build
复制代码
3,修改房间服务的启动密码


作者: zangcf    时间: 2016-8-11 12:05
实际运行有错误:
0.854: Initializing; server= undefined.
apprtc.debug.js:4085 0.860: Initializing; room=undefined.
apprtc.debug.js:4085 20.789: Opening signaling channel.
apprtc.debug.js:4085 20.797: Got access to local media with mediaConstraints:
  '{"video":{"optional":[{"minWidth":"1280"},{"minHeight":"720"}],"mandatory":{}},"audio":true}'
apprtc.debug.js:4085 20.798: User has granted access to local media.
apprtc.debug.js:4085 20.799: Attaching local stream.
apprtc.debug.js:3985 POST https://120.76.203.222/apprtc/iceconfig.php?key=none 404 (Not Found)(anonymous function) @ apprtc.debug.js:3985sendUrlRequest @ apprtc.debug.js:3966sendAsyncUrlRequest @ apprtc.debug.js:3963(anonymous function) @ apprtc.debug.js:3993requestIceServers @ apprtc.debug.js:3992Call.maybeGetIceServers_ @ apprtc.debug.js:2445Call.requestMediaAndIceServers_ @ apprtc.debug.js:2254Call @ apprtc.debug.js:2250AppController.createCall_ @ apprtc.debug.js:1895(anonymous function) @ apprtc.debug.js:1928RoomSelection.loadRoom_ @ apprtc.debug.js:3360RoomSelection.onJoinButton_ @ apprtc.debug.js:3349
apprtc.debug.js:4085 20.831: ICE server request error: Status=404, response=<html>
<head>
  <title>404 Not Found</title>
</head>
<body>
  <h1>404 Not Found</h1>
  The resource could not be found.<br /><br />



</body>
</html>
apprtc.debug.js:4085 20.852: Joined the room.
apprtc.debug.js:4085 22.797: Signaling channel opened.
apprtc.debug.js:4085 22.799: Registering signaling channel.
apprtc.debug.js:4085 22.800: Signaling channel registered.
apprtc.debug.js:4085 22.801: Starting signaling.
apprtc.debug.js:4085 22.802: Failed to start signaling: Failed to execute 'pushState' on 'History': A history state object with URL 'http://120.76.203.222/r/434116090' cannot be created in a document with origin 'https://120.76.203.222' and URL 'https://120.76.203.222/'.
apprtc.debug.js:4085 77.700: WSS->C: {"msg":"{\"type\":\"bye\"}","error":""}
apprtc.debug.js:2561 Uncaught TypeError: Cannot read property 'receiveSignalingMessage' of nullCall.onRecvSignalingChannelMessage_ @ apprtc.debug.js:2561(anonymous function) @ apprtc.debug.js:3795
apprtc.debug.js:4085 77.745: ECDSA certificate generated successfully.
apprtc.debug.js:4085 77.746: Creating RTCPeerConnnection with:
  config: '{"iceServers":[],"rtcpMuxPolicy":"require","bundlePolicy":"max-bundle","certificates":[{}]}';
  constraints: '{"optional":[]}'.
apprtc.debug.js:4085 77.751: Created PeerConnectionClient




欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2