Angular Apache2 https:为实时流媒体启用WebSocket
我正试图在ubuntu操作系统的apache2 https服务器下安装angular应用程序 我通过这个链接在apache2下启用https。因此,apache2 https站点在/etc/apache2/sites available/default-ssl.conf中配置如下: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
<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文件。但这并不能解决问题
有什么解决这个问题的建议吗