How to Install Spreed WebRTC Server on Ubuntu 16.04

Spreed is a free open-source (AGPL) WebRTC audio/video call and conferencing server designed with privacy in mind. WebRTC is a free and open technology allows browsers to talk to each other in a peer-to-peer fashion. Spreed WebRTC server uses end-to-end encryption to protect users’ privacy and security.

Spreed WebRTC allows you to do the following things.

  • Secure audio, video and text chat
  • Web conferencing
  • One to one video chat

This tutorial is going to show you how to install Spreed WebRTC server on Ubuntu 16.04 VPS or dedicated server.

Install Spreed WebRTC Server on Ubuntu 16.04 from official PPA

We can easily install Spreed WebRTC server from official PPA on Ubuntu 16.04.

sudo apt-add-repository ppa:strukturag/spreed-webrtc

sudo apt update

sudo apt install spreed-webrtc

Once installed, spreed-webtrc will be automatically started and its built-in web server listens on 127.0.0.1:8080. You can check its status with:

systemctl status spreed-webrtc

Output:

 spreed-webrtc.service - Spreed WebRTC server
   Loaded: loaded (/lib/systemd/system/spreed-webrtc.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2016-12-13 02:28:18 EST; 3min 0s ago
 Main PID: 925 (spreed-webrtc-s)
    Tasks: 5
   Memory: 1.1M
      CPU: 14ms
   CGroup: /system.slice/spreed-webrtc.service
           └─925 /usr/sbin/spreed-webrtc-server -c /etc/spreed/webrtc.conf -l /var/log/spreed/webrtc/server.log

If it isn’t running, then manually start it with:

sudo systemctl start spreed-webrtc

And also enable auto start at boot time:

sudo systemctl enable spreed-webrtc

The main configuration file is /etc/spreed/webrtc.conf.

Setting Up Nginx Reverse Proxy

Spreed WebRTC by default listens on localhost. To access the web interface from a browser, we need to set up a reverse proxy for it using Nginx or Apache.

If you use Nginx, follow these instructions. 

First, install Nginx.

sudo apt install nginx

Then create a server block file for Spreed WebRTC.

sudo nano /etc/nginx/conf.d/spreed-webrtc.conf

Put the following text into the file. Replace spreed.your-domain.com with your preferred domain name and don’t forget to set an A record.

server {
        listen 80;
        server_name spreed.your-domain.com;
        location / {
                proxy_pass http://127.0.0.1:8080;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                proxy_buffering             on;
                proxy_ignore_client_abort   off;
                proxy_redirect              off;
                proxy_connect_timeout       90;
                proxy_send_timeout          90;
                proxy_read_timeout          90;
                proxy_buffer_size           4k;
                proxy_buffers               4 32k;
                proxy_busy_buffers_size     64k;
                proxy_temp_file_write_size  64k;
                proxy_next_upstream         error timeout invalid_header http_502 http_503 http_504;
        }

        location ~ /.well-known/acme-challenge {
             root /usr/share/nginx/spreed/;
             allow all;
        }
}

Save and close the file. Then test Nginx configurations and reload.

sudo nginx -t

sudo systemctl reload nginx

Now you should be able to access Spreed WebRTC via a domain name from web browser.

spreed webrtc server

Setting Up Apache Reverse Proxy

If you use Apache, following these instructions.

Install Apache web server.

sudo apt install apache2

Then create a virtual host file for Spreed.

sudo nano /etc/apache2/sites-available/spreed-webrtc.conf

Put the following text into the file. Replace spreed.your-domain.com with your preferred domain name and don’t forget to set an A record.

<VirtualHost *:80>
    ServerName spreed.your-domain.com
    <Location />
      ProxyPass http://127.0.0.1:8080/
      ProxyPassReverse http://127.0.0.1:8080/
    </Location>

    <Location /ws>
       ProxyPass ws://127.0.0.1:8080/
    </Location>
    ProxyVia On
    ProxyPreserveHost On
</VirtualHost>

Save and close the file.  Then we need to enable proxy_http module.

sudo a2enmod proxy_http

Next, enable this virtual host.

sudo a2ensite spreed-webrtc.conf

Test configurations and reload Apache

sudo apachectl configtest

sudo systemctl reload apache2

Now you should be able to access Spreed WebRTC via a domain name from web browser.

spreed webrtc server

Enabling HTTPS

To obtain a TLS certificate and encrypt your communication with Spreed WebRTC, please see the following article.

That’s it!

I hope this tutorial helped you install Spreed WebRTC server on Ubuntu 16.04. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Google+ Twitter or like our Facebook page.

Rate this tutorial
[Total: 5 Average: 4.4]