2016-11-21 2 views
0

WebRTCを使用して2つのデバイス(ブラウザ)間でファイルを転送しようとしています。私はこのGitHub repoに続いてsignalmasterシグナリングサーバを設定しました。うまくいきました。だから、簡単なindex.htmlページを同じフォルダに入れます。しかし、私がhttp://localhost:8888に行くと、ページが表示されません。私は、SignalingサーバーがWebサーバーではないことを理解しています。だから、Web server for chromeを使ってWebサーバーをセットアップしました。WebRTC:サインインサーバーとウェブサーバーを一緒にセットアップするにはどうしたらいいですか?

この時点で

私は混乱しておよそ午前:

  1. シグナル・サーバーを必要とウェブサーバを持ちながら!!
  2. ウェブページを読み込めない場合、どのようにシグナリングサーバを使用するのですか?

シンプルで、なぜ私はすでにそれを使用していない場合のための信号サーバーが必要ですか?また、私のページが読み込まれるようにsigning-serverとwebserverを一緒にセットアップできますか?

答えて

1

それはnodejs、PHPとnginxのと組み合わせて、あなたの現在のWebページを使用することが可能です。Nodejsとシグナリングサーバは、ポート8888のバックグラウンドで実行されており、リバースプロキシを使用すると、URLにポートなしでWebページを呼び出すことができます。

server { 
    listen 80 default; 

    server_name http://192.168.229.128; 


    root /var/www/html; 

    index index.php index.html index.htm index.nginx-debian.html; 

    location/{ 
      proxy_pass http://localhost:8888; 
      proxy_http_version 1.1; 
      proxy_set_header Upgrade $http_upgrade; 
      proxy_set_header Connection 'upgrade'; 
      proxy_set_header Host $host; 
      proxy_cache_bypass $http_upgrade; 
    } 


    location ~ \.php$ { 
    try_files $uri =404; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include fastcgi_params; 
} 



    location ~* \.io { 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_set_header X-NginX-Proxy true; 

    proxy_pass http://localhost:8888; 
    proxy_redirect off; 

    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    } 



} 

この場合、socket.ioが使用されますが、必要に応じて削除できます。

関連する問題