How to Integrate Spreed Me WebRTC with NextCloud

Spreed ME WebRTC aims to bring private text, audio/video chat back to people. It’s like a free open source and self-hosted alternative to Google Hangouts. In previous tutorials, we discussed how to install Spreed WebRTC using Docker image. This tutorial is going to show you how to integrate Spreed WebRTC with NextCloud.

To follow this tutorial, it is assumed that you have already set up a NextCloud server with HTTPS enabled and you have followed our previous tutorials on installing Spreed WebRTC.

Once you finish this tutorial, you will have the ability to:

  • Start private text, audio/video chat with NextCloud users or non-NextCloud users from NextCloud installation.
  • Share files from NextCloud or save shared files to NextCloud.
  • Share your computer screen or YouTube video.

So without further ado, let’s get started.

Same Origin

To use the screensharing feature, we need to let Spreed and NextCloud run on the same origin. Same origin means that Spreed and Nextcloud can be accessed using the same protocol scheme, the same domain name and the same port number.

So if your Nextcloud installation is accessed via

Then you can put Spreed WebRTC on a sub-directory of your NextCloud installation.

So that they are of the same origin.

Changing basePath

To let Spreed WebRTC know that it will be accessed via /webrtc sub-directory, we need to edit the server.conf file.

sudo nano /etc/spreed/server.conf

Find the following line.

;basePath = /some/sub/path/

Change it to

basePath = /webrtc

Save and close the file. Then restart Spreed WebRTC server for the changes to take effect.

If you installed Spreed on Ubuntu 16.04 from official PPA, then restart it with:

sudo systemctl restart spreed-webrtc

If you installed Spreed using docker image, then restart the docker container with:

sudo docker restart my-spreed-webrtc

Setting up Reverse Proxy

To put Spreed WebRTC on a sub-directory of NextCloud installation, we need to set up a reverse proxy. We can use either Apache or Nginx. First, let’s see how to do it with Apache.

Apache Reverse Proxy Config

Open the https version of NextCloud virtual host file.

sudo nano /etc/apache2/sites-available/nextcloud-ssl.conf

Then put the following lines above </VirtualHost>.

<Location /webrtc>
  ProxyPassReverse /webrtc

<Location /webrtc/ws>
  ProxyPass ws://

ProxyVia On
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto 'https' env=HTTPS

Save and close the file. Then run the following command to enable some Apache modules to make proxy work.

sudo a2enmod proxy proxy_http proxy_wstunnel headers

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now you should be able to access Spreed WebRTC from the /webrtc sub-directory of your NextCloud installation. When your browser asks to access your camera, click Allow.

spreed webrtc nextcloud

Nginx Reverse Proxy Config

Open your NextCloud server block file.

sudo nano /etc/nginx/conf.d/nextcloud.conf

Put the following lines under the https server context.

location ^~ /webrtc {               
         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;

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

sudo nginx -t

sudo systemctl reload nginx

Now you should be able to access Spreed WebRTC from the /webrtc sub-directory of your NextCloud installation. When your browser asks to access your camera, click Allow.

spreed webrtc nextcloud

Installing the Spreed ME NextCloud App

Go to NextCloud App store.

nextcloud app store

Then click Tools tab on the left. Find Spreed.ME app.  Click Enable button. nextcloud app

Next, go to Nextcloud admin page, click Additional settings and scroll down to bottom of the page. Once you see the Spreed.ME section, click Generate Spreed WebRTC config button. nextcloud

Now copy the Spreed WebRTC config generated by Spreed.ME app and don’t forget to click Save Settings.

spreed webrtc config

Then rename /etc/spreed/server.conf to /etc/spreed/server.conf.bak.

sudo mv /etc/spreed/server.conf /etc/spreed/server.conf.bak

Create a new server.conf file.

sudo nano /etc/spreed/server.conf

And paste the Spreed WebRTC config into the file. Save and close the file.  Restart Spreed WebRTC server.

sudo systemctl restart spreed-webrtc

If you are running Spreed WebRTC using Docker image, first you need to comment out the listen = line in server.conf by adding a semicolon.

; listen =

Then you should stop and remove the existing Spreed WebRTC container.

sudo docker stop my-spreed-webrtc

sudo docker rm my-spreed-webrtc

Next you need to start a new Spreed WebRTC container and also mount /var/www/nextcloud/apps/spreedme/extra/ to the container. Replace /var/www/nextcloud with your own NextCloud webroot path.

sudo docker run -d --name my-spreed-webrtc -p 8080:8080 -p 8443:8443 -v /etc/spreed:/etc/spreed -v /var/log/spreed:/var/log/spreed -v /var/www/nextcloud/apps/spreedme/extra:/var/www/nextcloud/apps/spreedme/extra -i -t spreed/webrtc -c /etc/spreed/server.conf

Accessing Spreed ME via NextCloud

Once the above is done, go to the Speed.ME app from NextCloud web interface.

nextcloud spreedme

And now you can access Spreed ME chat room right from NextCloud installation.

nextcloud spreed me integration

To invite non-Nextcloud user to join room chat, first you need to enable temporary password by going to Nextcloud admin page > Additional settings > Spree.ME > Advanced settings. Then check OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED. Save your settings.

nextcloud enable temporary password

Now a key icon will appear next to Spreed.ME chat room which allows you to generate temporary password. temporary room password

Note: NextCloud 11 introduced another app called Spreed Video Calls, which allows Nextcloud users to make video call. This is different from the Spreed ME app.

That’s it!

I hope this tutorial helped you integrate Spreed ME WebRTC with NextCloud. 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: 7 Average: 4]

2 Responses to “How to Integrate Spreed Me WebRTC with NextCloud

  • Thank you for this very good tutorial. Worked for me. I just added –restart always in the docker image. One thing I cannot do though is receive a file. I can receive a file, but whenever I try to send one, the transfer does not start and an error message is displayed (“download failed”). How can I solve this?

  • jokermagic guz
    3 weeks ago

    Disculapa no logro ver el icono de Youtube ni el del monitor ni la carpeta sabras por que ?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here