We want to use Apache2 as reverse proxy like Nginx in front of Ant Media Server. Even if http/s connections are succesfull, websocket connection cannot be established and we cannot publish webrtc live stream to Ant Media Server. What do you recommend to make it work?
Asked
Active
Viewed 164 times
1 Answers
1
here are the instruction for how to use Apache as reverse proxy.
- Enable the modules:
a2enmod proxy proxy_http proxy_wstunnel
- Edit
/etc/apache2/sites-enabled/ams.conffile
<VirtualHost *:443>
ServerName yourdomain.com
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/yourdomain.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLCertificateChainFile /etc/apache2/ssl/yourchain.crt
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:5080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:5080/$1 [P,L]
ProxyPass / http://localhost:5080/
ProxyPassReverse / http://localhost:5080/
</VirtualHost>
- And restart the apache2 service:
systemctl restart apache2
Usama
- 131