Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Apache2 https:为实时流媒体启用WebSocket_Angular_Apache_Https_Websocket_Apache2 Module - Fatal编程技术网

Angular Apache2 https:为实时流媒体启用WebSocket

Angular Apache2 https:为实时流媒体启用WebSocket,angular,apache,https,websocket,apache2-module,Angular,Apache,Https,Websocket,Apache2 Module,我正试图在ubuntu操作系统的apache2 https服务器下安装angular应用程序 我通过这个链接在apache2下启用https。因此,apache2 https站点在/etc/apache2/sites available/default-ssl.conf中配置如下: <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost

我正试图在ubuntu操作系统的apache2 https服务器下安装angular应用程序

我通过这个链接在apache2下启用https。因此,apache2 https站点在/etc/apache2/sites available/default-ssl.conf中配置如下:

<IfModule mod_ssl.c>
    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
            ServerName https://my_ip/
            DocumentRoot /var/www/html

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

            SSLEngine on

            SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
            SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                    SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                    SSLOptions +StdEnvVars
            </Directory>
    </VirtualHost>
</IfModule>
new JSMpeg.Player('ws://my_ip:9999', {
    canvas: this.streamingcanvas.nativeElement, autoplay: true, audio: false, loop: true
      })
我的angular应用程序运行良好,如果使用npm start执行。但在https服务器下,不会显示流

经过思考,我猜可能有一些与WebSocket相关的东西应该在我的apache2服务器中配置。搜索后,我找到了此链接:

因此,我使用a2enmod命令在apache2中启用了ws,并添加了以下行:

RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "wss://my_ip:9999/$1" [P,L]

ProxyPass / https://my_ip:9999/
ProxyPassReverse / https://my_ip:9999/
ProxyRequests off
到VirtualHost标记下的/etc/apache2/sites available/default-ssl.conf文件。但这并不能解决问题

有什么解决这个问题的建议吗