WebRTC:如何同时设置签名服务器和Web服务器?

WebRTC:如何同时设置签名服务器和Web服务器?,webrtc,Webrtc,我正在尝试使用WebRTC在两个设备(浏览器)之间传输文件。我按照这个步骤设置了signalmaster信令服务器,它工作正常。因此,我将一个简单的index.html页面放在同一个文件夹中。但是当我转到http://localhost:8888,它不显示页面。然后我发现信令服务器不是Web服务器。因此,我使用webserver for chrome设置了一个Web服务器 在这一点上,我感到困惑: 在拥有Web服务器的同时需要信令服务器!!及 如果我无法加载网页,我将如何使用信号服务器 简单地说

我正在尝试使用WebRTC在两个设备(浏览器)之间传输文件。我按照这个步骤设置了
signalmaster
信令服务器,它工作正常。因此,我将一个简单的
index.html
页面放在同一个文件夹中。但是当我转到
http://localhost:8888
,它不显示页面。然后我发现信令服务器不是Web服务器。因此,我使用
webserver for chrome
设置了一个Web服务器

在这一点上,我感到困惑:

  • 在拥有Web服务器的同时需要信令服务器!!及
  • 如果我无法加载网页,我将如何使用信号服务器
    简单地说,如果我还没有使用信令服务器,为什么我还需要它呢?!另外,我怎样才能同时设置签名服务器和Web服务器,以便加载我的页面

    这很好地概述了信令服务器在WebRTC中扮演的角色:

    这很好地概述了信号服务器在WebRTC中扮演的角色:

    您可以将当前网页与nodejs、php和nginx结合使用。 Nodejs和信令服务器在端口8888的后台运行,通过反向代理,您可以在url中没有端口的情况下调用网页

    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,但如果需要,可以将其删除。

    可以将当前网页与nodejs、php和nginx结合使用。 Nodejs和信令服务器在端口8888的后台运行,通过反向代理,您可以在url中没有端口的情况下调用网页

    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,但如果需要,可以将其删除