# Nextcloud in Docker with Collabora Code

**URL:** <https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201>\
**Category:** 📄 Office\
**Tags:** collabora-online\
**Created:** [November 5, 2022, 6:51pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201 "2022-11-05T18:51:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 5, 2022, 6:51pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/1 "2022-11-05T18:51:53Z")

</div>

Hi,

i have a functional Nextcloud installation with Docker and want to use Collabora Online with builtin Code App and Office App.

So i installed both. If i try to open a document, i only get an error: “cant open document”

If i go in the settings of Office and swap between own and builtin code i get this message: “should be the same protocoll”

My Nextcloud Server is http with overrideprotocol to https, cause i use a reverse proxy and the passwords app doesnt work without https override. For the builtin Code i cant set anything like this.

How i can solve it?  
i wont use certificate rollout from my reverse proxy.

Thanks

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 5, 2022, 8:57pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/2 "2022-11-05T20:57:06Z")

</div>

> [@corin.corvus](#):
>
> should be the same protocoll

It looks built-in CODE doesn’t take into account tweaks applied to NC… somebody reported this issue shortly (don’t have the reference handy)…

I have no good hint for built-in CODE… as your are using Docker and Reverse Proxy you could easily setup _regular_ Docker CODE image which is more mature in my eyes. And you definitely have little more control over moving parts of the installation.

Take a look [here](https://help.nextcloud.com/t/docker-compose-for-nextcloud-collabora-traefik/127733/2) for example with docker and traefik - should be not hard to adopt for other RP.

---

<div class="post-metadata">

**Author:** ![KarlF12](https://help.nextcloud.com/user_avatar/help.nextcloud.com/karlf12/32/46873_2.png) [@KarlF12](https://help.nextcloud.com/u/KarlF12)\
**Post date:** [November 6, 2022, 1:20am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/3 "2022-11-06T01:20:10Z")

</div>

I wrote a guide based on Apache reverse proxy you can try if you want. It’s for a little bit older version but still mostly accurate.

> [@HowTo: Ubuntu + Docker + Nextcloud + Talk + Collabora](https://help.nextcloud.com/t/howto-ubuntu-docker-nextcloud-talk-collabora/76430):
>
> 1.Overview This is a general guide to setting up a functional Nextcloud instance using Ubuntu Server 18.04.3, Docker CE, Docker-Compose, Collabora CODE, and an Apache reverse proxy. By the end (and as of writing), this setup will have an A+ rating on [Nextcloud Security Scan](https://scan.nextcloud.com/) and [Qualys SSL Server Test](https://www.ssllabs.com/ssltest/) and a valid, self-updating certificate from Let’s Encrypt. I will also cover how to update everything. I will do my best to plainly emphasize things that you will need to change, but it will mainly…

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 7, 2022, 7:53am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/4 "2022-11-07T07:53:39Z")

</div>

I created the docker now and added collabora code in my compose. the envs i edit:

```auto
  collabora:
    image: collabora/code

    restart: unless-stopped
    networks:
      - nextcloud
    ports:
      - "127.0.0.1:9980:9980"
    extra_hosts:
      - "cloud.domain:10.0.0.41"
      - "office.domain:10.0.0.41"
    environment:
      - 'domain=cloud.domain'
      - 'dictionaries=de'
    cap_add:
      - MKNOD
    tty: true

```

The Docker is not reachable with http and https.

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/f/2/f2c825f8c61d8808065b2f8e5c141866d7286237.png)

Docker is running, no errors in log.

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/1/c/1c3bab8b9c981936d28dc09cb45d9603584d77f1.png)

What could be wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 7, 2022, 9:01am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/5 "2022-11-07T09:01:36Z")

</div>

> [@corin.corvus](#):
>
> ```auto
> ports:
> - "127.0.0.1:9980:9980"
> 
> ```

with this directive you configure the port `:9980` to listen only on ip `127.0.0.1`. most likely you want

```auto
    ports:
      - "9980:9980"

```

> [@corin.corvus](#):
>
> `- 'domain=cloud.domain'`

this directive is outdated (use for CODE up to 6.4) newer CODE versions don’t require this config for single-server installations and only need `aliasgroup` if [multiple clouds access a single CODE server](https://help.nextcloud.com/t/important-changes-that-seem-to-affect-cool-docker-versions-from-v21-11-3-6-on-multiple-domains-setup/137867)

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 7, 2022, 9:29am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/6 "2022-11-07T09:29:08Z")

</div>

Ok. i only followed the howto. i change it. Locally it now works on https:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/9/a/9ac22a5002a7ea1b108ec89781780d29364afa3b.png)

i added this on collabora too:

```auto
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"

```

Over Domain it works too:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/8/c/8c4bf4c573c4e325ca7bf87bddfd560c29357079.png)

But in the Config of Nextcloud it doesnt work:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/d/8/d8fccd377d5905ee87015c87b5437fdd3e45235f.png)

Container Nextcloud App Test:

```auto
root@9ae703952336:/var/www/html# curl 10.0.0.41:9980
OK
root@9ae703952336:/var/www/html# curl office.domain
curl: (7) Failed to connect to office.domain port 80: Connection refused
root@9ae703952336:/var/www/html# curl https://office.domain
curl: (7) Failed to connect to office.domain port 443: Connection refused
root@9ae703952336:/var/www/html# curl office.domain:9980
OK
root@9ae703952336:/var/www/html# 

```

If i change the office ip address in the stack config to my reverse proxy the Nextcloud Settings are fine, but open a document failed

Nginx Config for 443:

```auto
upstream office {
 server 10.0.0.41:9980;
}

server {
    listen 443 ssl http2;
	listen [::]:443 http2;
    server_name office.domain;
    ssl_certificate /root/.acme.sh/office.domain/fullchain.cer; 
    ssl_certificate_key /root/.acme.sh/office.domain/office.domain.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
	client_max_body_size 20000m;
    fastcgi_buffer_size 4k;
	fastcgi_buffers 64 4k;
    fastcgi_hide_header X-Powered-By;

    access_log /var/log/nginx/office-access.log adv;
    error_log /var/log/nginx/office-error.log notice;

location ~ / {
    proxy_pass https://office;
    proxy_set_header Host $http_host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header User-Agent $http_user_agent;
#	proxy_hide_header Upgrade;
#	proxy_ssl_verify off;

	}
}

```

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 7, 2022, 10:32am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/7 "2022-11-07T10:32:17Z")

</div>

Collabora integration with reverse proxy works like shown in this drawing

 ![image](https://help.nextcloud.com/uploads/default/original/3X/b/b/bb806e4707aea82138692b953d92bac7f846f34a.png)

as I get from previous post

- **assume** connection from client to Nextcloud works ([https://cloud.domain](https://cloud.domain)) ✅
- connection from client to Collabora works ([https://office.domain](https://office.domain)) ✅
- connection from Nextcloud to Collabora doesn’t work ❌
- connection from Collabora to Nextcloud not tested so far ❌

> [@corin.corvus](#):
>
> this is the next point to analyze:
> 
> ```auto
> root@9ae703952336:/var/www/html# curl https://office.domain
> curl: (7) Failed to connect to office.domain port 443: Connection refused
> 
> ```

For some reason communication from Nextcloud to Collabora doesn’t work. There might be different reasons e.g. missing/bad DNS resolution, routing or firewall issues or untrusted certificate (from NCs point of view).

PS: it’s more or less pointless to verify connections to the IP and port 9980 - this connection don’t happen _in real life_ and only _may_ help you to troubleshoot. please focus on required connection to `https://office.domain` and `https://cloud.domain` obviously both on port 443

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 7, 2022, 11:01am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/8 "2022-11-07T11:01:36Z")

</div>

Okay, if i want to do it like the picture, i need to use the reverse proxy ip on the compose file, cause the containers are on another vm and only communicate in http.

if i do that:  
extra\_hosts:  
- “cloud.domain:10.0.0.7”  
- “office.domain:10.0.0.7”

the Setting in Nextcloud is “OK” but only nginx access log notice the “save” and Test.  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/b/a/ba083f8eda8b58f03e8a04ff71a58622bf4a2e44.png)

On the log of the office container i dont get any entries.  
Nginx:  
site=“office.domain” server=“office.domain dest\_port=“443” dest\_ip=“10.0.0.7” src=“10.0.0.41” src\_ip=“10.0.0.41” user=”-" time\_local=“07/Nov/2022:11:51:13 +0100” protocol=“HTTP/1.1” status=“200” bytes\_out=“526” http\_user\_agent=“Nextcloud Server Crawler” nginx\_version=“1.14.2” http\_x\_forwarded\_for=“-” http\_x\_header=“-” uri\_query=“-” uri\_path=“/hosting/capabilities” http\_method=“GET” response\_time=“0.012” cookie=“-” request\_time=“0.011”

But i cant open documents. The Accesslog of office doesnt tell me more, the cloud access log is not useful.

Curl:

```auto
root@5d65b90847b2:/var/www/html# curl office.domain
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
root@5d65b90847b2:/var/www/html# curl https://office.domain
OK
root@5d65b90847b2:/var/www/html# 

```

With https in the console of nextcloud container i get a Ok. Only with hostname i get nginx 301, its port 80.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 7, 2022, 12:07pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/9 "2022-11-07T12:07:28Z")

</div>

> [@corin.corvus](#):
>
> ```auto
> root@5d65b90847b2:/var/www/html# curl https://office.domain
> OK
> 
> ```

you are getting closer. Please run and post the tests I asked before (see troubleshooting guide referred above for details).

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 8, 2022, 6:09pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/10 "2022-11-08T18:09:22Z")

</div>

I dont find a solution. I have no idea, how i can solve this. I tried, the config except the traefik is identical… but it doesnt work.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 8, 2022, 7:59pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/11 "2022-11-08T19:59:12Z")

</div>

> [@corin.corvus](#):
>
> I dont find a solution.

well this is likely the reason you post here. but in order to help you all the volunteers here need **you** to provide informations what is going wrong. in this case run some commands and describe the output.

pro hint: running curl with **-v** provides more verbose output (see [manpage](https://curl.se/docs/manpage.html#-v)).

---

<div class="post-metadata">

**Author:** ![marko1](https://help.nextcloud.com/letter_avatar/marko1/32/6_449c533f586939b6e5f246632a46421f.png) [@marko1](https://help.nextcloud.com/u/marko1)\
**Post date:** [November 8, 2022, 8:55pm UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/12 "2022-11-08T20:55:48Z")

</div>

Try to add RootCa to nextcloud.

`sudo nano nextcloud/resources/config/ca-bundle.crt`

Append at bottom.

Also, try setting the Debug level of logging, otherwise you won’t see much.

And one more thing, if you started collabora with ssl.enabled=false and termination you have to have [http://office](http://office) in your nginx conf.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 9, 2022, 6:15am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/13 "2022-11-09T06:15:21Z")

</div>

Where is the RootCA in the collabora container? i dont find the file.

nginx config is already http and correct.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 9, 2022, 6:24am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/14 "2022-11-09T06:24:49Z")

</div>

Curl from Nextcloud app Container to Collabora Container:

```auto
curl -v https://office.domain
* Trying 10.0.0.40:443...
* Connected to office.domain (10.0.0.40) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=office.domain
* start date: Nov 7 06:23:40 2022 GMT
* expire date: Feb 5 06:23:39 2023 GMT
* subjectAltName: host "office.domain" matched cert's "office.domain"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55645fe7e2c0)
> GET / HTTP/2
> Host: office.domain
> user-agent: curl/7.74.0
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< server: nginx/1.14.2
< date: Wed, 09 Nov 2022 06:18:02 GMT
< content-type: 10
< content-length: 2
< last-modified: Wed, 09 Nov 2022 06:18:02
< 
* Connection #0 to host office.domain left intact

```

Collabora to Cloud:

```auto
cool@96120713b535:/$ curl -v https://cloud.domain
* Rebuilt URL to: https://cloud.domain/
* Trying 10.0.0.40...
* TCP_NODELAY set
* Connected to cloud.domain (10.0.0.40) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=cloud.domain
* start date: Oct 9 21:00:07 2022 GMT
* expire date: Jan 7 21:00:06 2023 GMT
* subjectAltName: host "cloud.domain" matched cert's "cloud.domain"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x561e7064f620)
> GET / HTTP/2
> Host: cloud.domain
> User-Agent: curl/7.58.0
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< server: nginx/1.14.2
< date: Wed, 09 Nov 2022 06:20:16 GMT
< content-type: text/html; charset=utf-8
< content-length: 156
< referrer-policy: no-referrer
< x-content-type-options: nosniff
< x-frame-options: SAMEORIGIN
< x-permitted-cross-domain-policies: none
< x-robots-tag: none
< x-xss-protection: 1; mode=block
< last-modified: Sun, 30 Oct 2022 09:59:22 GMT
< etag: "9c-5ec3d8b94dfde"
< accept-ranges: bytes
< vary: Accept-Encoding
< 
<!DOCTYPE html>
<html>
<head>
        <script> window.location.href="index.php"; </script>
        <meta http-equiv="refresh" content="0; URL=index.php">
</head>
</html>
* Connection #0 to host cloud.domain left intact

```

The “Extra Hosts” Settings go to my Reverse Proxy at the moment.  
10.0.0.40 is my Reverse Proxy  
10.0.0.41 is my Docker Server with Nextcloud and Collabora

Compose:

```auto
version: '2'

volumes:
  nextcloud:
  db:

networks:
 nextcloud:

services:
  db:
    image: mariadb:10.5
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
      - /opt/portainer/nextcloud/mariaconf:/etc/mysql/conf.d
      - /etc/localtime:/etc/localtime:ro
    networks:
      - nextcloud
    environment:
      - MYSQL_ROOT_PASSWORD=Secret
      - MYSQL_PASSWORD=Secret
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nc
  redis:
    image: redis
    restart: always
    command: redis-server --requirepass Secret
    networks:
      - nextcloud
  app:
    image: c-lab-nextcloud:latest
    restart: always
    ports:
      - 12003:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
      - /opt/portainer/nextcloud/data:/var/www/html/data
      - /etc/localtime:/etc/localtime:ro
    networks:
      - nextcloud
    extra_hosts:
      - "office.domain:10.0.0.40"
    environment:
      - MYSQL_PASSWORD=Secret
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nc
      - MYSQL_HOST=db
      - PHP_MEMORY_LIMIT=4G
      - PHP_UPLOAD_LIMIT=20G
      - REDIS_HOST_PASSWORD=Secret

    depends_on:
      - db
      - redis
  collabora:
    image: collabora/code

    restart: unless-stopped
    networks:
      - nextcloud
    ports:
      - "9980:9980"
    extra_hosts:
      - "cloud.domain:10.0.0.40"
      - "office.domain:10.0.0.40"
    environment:
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
      - 'dictionaries=de_DE'
    cap_add:
      - MKNOD
    tty: true

```

Nginx Settings:  
Cloud:

```auto
upstream nextcloud {
 server 10.0.0.41:12003 max_fails=1 fail_timeout=10;
}

server {
    listen 443 ssl http2;
	listen [::]:443 http2;
    server_name cloud.domain;
    ssl_certificate /root/.acme.sh/cloud.domain/fullchain.cer; 
    ssl_certificate_key /root/.acme.sh/cloud.domain/cloud.domain.key;

	# Enable gzip but do not remove ETag headers
    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

    ssl_protocols TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
	client_max_body_size 20000m;
    fastcgi_buffer_size 4k;
	fastcgi_buffers 64 4k;
    fastcgi_hide_header X-Powered-By;

    access_log /var/log/nginx/cloud-access.log adv;
    error_log /var/log/nginx/cloud-error.log notice;

location ~ / {
    proxy_pass http://nextcloud;
    proxy_set_header Host $server_name;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header User-Agent $http_user_agent;
	proxy_hide_header Upgrade;
	proxy_ssl_verify off;

	
	
	    #proxy_send_timeout 180s;
	    #proxy_read_timeout 180s;

  
		proxy_ssl_session_reuse off;
		proxy_max_temp_file_size 0;
	}

    # Rule borrowed from `.htaccess` to handle Microsoft DAV clients
    location = / {
        if ( $http_user_agent ~ ^DavClnt ) {
            return 302 /remote.php/webdav/$is_args$args;
        }
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ^~ /.well-known {
        # The rules in this block are an adaptation of the rules
        # in `.htaccess` that concern `/.well-known`.
		
		location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav { return 301 /remote.php/dav/; }
		location = /.well-known/webfinger { return 301 /index.php/webfinger; }
        location = /.well-known/nodeinfo { return 301 /index.php/nodeinfo; }
        location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation { try_files $uri $uri/ =404; }
	}

#location ~ ^(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {}

    # Rules borrowed from `.htaccess` to hide certain paths from clients
# location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
# location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }

}

 

```

Office:

```auto
upstream office {
 server 10.0.0.41:9980;
}

server {
    listen 443 ssl http2;
	listen [::]:443 http2;
    server_name office.domain;
    ssl_certificate /root/.acme.sh/office.domain/fullchain.cer; 
    ssl_certificate_key /root/.acme.sh/office.domain/office.domain.key;

    ssl_protocols TLSv1.2;
# ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
# ssl_prefer_server_ciphers on;
#	client_max_body_size 20000m;
# fastcgi_buffer_size 4k;
#	fastcgi_buffers 64 4k;
# fastcgi_hide_header X-Powered-By;

    access_log /var/log/nginx/office-access.log adv;
    error_log /var/log/nginx/office-error.log notice;

location ~ / {
    proxy_pass http://office;
# proxy_set_header Host $http_host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header User-Agent $http_user_agent;
#	proxy_hide_header Upgrade;
#	proxy_ssl_verify off;

	}
}

```

NonSSL conf of nextcloud and office are identical except the servername, logpath and return 301

```auto
server {
	listen 80;
	listen [::]:80;
	server_name office.domain;
	client_max_body_size 20m;
	access_log /var/log/nginx/office-access.log adv;
	error_log /var/log/nginx/office-error.log notice;

    location /.well-known {
     root /var/www/letsencrypt;
    }    

    location / {
    return 301 https://office.domain$request_uri
;	}
}

```

Cloud Office Setting  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/6/b/6b285fb76dcf2e7e977d59e2b17ad4024a75c79a.png)

If i click the save button nginx office log:

```auto
site="office.domain" server="office.domain� dest_port="443" dest_ip="10.0.0.40" src="10.0.0.41" src_ip="10.0.0.41" user="-" time_local="09/Nov/2022:07:31:05 +0100" protocol="HTTP/1.1" status="200" bytes_out="526" http_user_agent="Nextcloud Server Crawler" nginx_version="1.14.2" http_x_forwarded_for="-" http_x_header="-" uri_query="-" uri_path="/hosting/capabilities" http_method="GET" response_time="0.004" cookie="-" request_time="0.000" 

```

No Logentry in collabora container. Last Log 5 o Clock AM:

```auto
2022-11-09T05:00:04.277457846Z sh: 1: /usr/bin/coolmount: Operation not permitted

```

If i want to open a Document:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/b/3/b37dab0e69c40fcbb6b0167772c5a2f9ffee93fd.png)

No logs on cloud, nginx or collabora while opening.

---

<div class="post-metadata">

**Author:** ![marko1](https://help.nextcloud.com/letter_avatar/marko1/32/6_449c533f586939b6e5f246632a46421f.png) [@marko1](https://help.nextcloud.com/u/marko1)\
**Post date:** [November 9, 2022, 6:40am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/15 "2022-11-09T06:40:14Z")

</div>

Ah, it was nightmare for me to setup this too.

Feel free to take a look here. This ansible script might not work for you, however all the config is there.

> <https://gitlab.com/marko-milic/raspberry-cloud/-/blob/main/deploy/playbooks/roles/nextcloud-deploy/templates/docker-compose.yml.j2>

> <https://gitlab.com/marko-milic/raspberry-cloud/-/blob/main/deploy/playbooks/roles/nginx-setup/templates/nginx.conf.j2>

Also, when you henerate certs, you habe to sign them with rootCa and if you geberated rootCa by yourself nextcloud and collabora page won’t load, at least for me. So i had to introduce that to nextcloud. In the container it is at /var/www/html/nextcloud I think.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 9, 2022, 6:45am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/16 "2022-11-09T06:45:57Z")

</div>

In the first Config File Collabora has “dont gen ssl cert” env.

I think here is the Cert.

cool@96120713b535:/etc$ cd coolwsd/  
cool@96120713b535:/etc/coolwsd$ ls  
ca-chain.cert.pem cert.pem coolkitconfig.xcu coolwsd.xml key.pem proof\_key proof\_key.pub  
cool@96120713b535:/etc/coolwsd$ ls -ltra  
total 72  
-rw-r–r-- 1 root root 9156 Oct 20 09:00 coolkitconfig.xcu  
drwxr-xr-x 1 root root 4096 Nov 8 18:52 …  
-rw-r–r-- 1 cool cool 399 Nov 8 18:52 proof\_key.pub  
-rw------- 1 cool cool 1679 Nov 8 18:52 proof\_key  
-rw-r–r-- 1 cool cool 1326 Nov 8 18:56 ca-chain.cert.pem  
-rw------- 1 cool cool 1679 Nov 8 18:56 key.pem  
-rw-r–r-- 1 cool cool 1196 Nov 8 18:56 cert.pem  
-rw-r----- 1 cool cool 26448 Nov 8 18:56 coolwsd.xml  
drwxr-xr-x 1 cool cool 4096 Nov 8 18:56 .  
cool@96120713b535:/etc/coolwsd$

But i dont use Certs on both Docker, only the Nginx Reverse Proxy has Certs.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 9, 2022, 8:27am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/17 "2022-11-09T08:27:16Z")

</div>

looks like network connection between both components works…

> [@corin.corvus](#):
>
> No logs on cloud, nginx or collabora while opening.

NC and Collabora containers print most important logs to docker stdout - please review with `docker logs <containername>`

Please open browser dev tools (F12) and check what happens when you try to open the document, in parallel collect container logs (maybe increasing logs level helps)… some requests going to both systems are expected… I don’t post everything only the most interesting requests (in my eyes):

1. client receives a token used by Collabora to access the document:

![image](https://help.nextcloud.com/uploads/default/original/3X/c/b/cb2592d4dfdd15c0e23f0fc3443976cf7a9a178b.png)

1. inside of the cloud session client talks with Collabora  
 ![image](https://help.nextcloud.com/uploads/default/original/3X/4/7/473180360cf43dd8d6bcfb47e57ca9f322a99d12.png)

2. Collabora access a URL of the cloud like (from cloud `docker logs`)

```auto
172.21.0.2 - - [09/Nov/2022:08:19:47 +0000] "GET /index.php/apps/richdocuments/wopi/files/128686_oc52dthqts8g?access_token=hAgGp4xVJQYx3FWp11YljfPo4Q07eNRI&access_token_ttl=1668017986000 HTTP/1.1" 200 2735 "-" "COOLWSD HTTP Agent 22.05.7.3"
172.21.0.2 - - [09/Nov/2022:08:19:47 +0000] "GET /index.php/apps/richdocuments/wopi/files/128686_oc52dthqts8g/contents?access_token=hAgGp4xVJQYx3FWp11YljfPo4Q07eNRI&access_token_ttl=1668017986000 HTTP/1.1" 200 12067 "-" "COOLWSD HTTP Agent 22.05.7.3"

```

1. nothing from interest visible in default Collabora output (–o:logging.level=warning) you might want to increase log level with `--o:logging.level=debug`

_screenshots and logs are from different attempts bare with me if tokens don’t match._

You must see all this requests on you reverse proxy as well…

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 9, 2022, 9:37am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/18 "2022-11-09T09:37:48Z")

</div>

> NC and Collabora containers print most important logs to docker stdout - please review with `docker logs <containername>`

I use Portainer to monitore my Container and the Log in Portainer is the docker log.

While opening the Document

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/b/4/b4f038012ebf8706b037323fd8bb529dfdabfd3e.png)

Security Message: Ein Fehler trat auf: SSL\_ERROR\_BAD\_CERT\_DOMAIN  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/2/c/2ca5b1edc823b465d1fb6b113663ce522ec3516e.png)

Thats not correct i think:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/f/5/f57338df794564761c50ca21e13e14965bbb0d2a.png)

I copied the Link. [https://office/](https://office/) get my browser. I think this is not correct. (I only edit cloudaddress in this link)  
`https://office/browser/b639546/cool.html?WOPISrc=https%3A%2F%2Fcloud.domain%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F21288_ocxhj39jv7tr&title=Netzplan.xlsx&lang=de&closebutton=1&revisionhistory=1`

No Log in Collabora (10:30 i opened the Document)

```auto
wsd-00001-00028 2022-11-09 09:24:57.734503 +0000 [prisoner_poll] TRC ppoll start, timeoutMicroS: 5000000 size 2| net/Socket.cpp:337
wsd-00001-00001 2022-11-09 09:24:57.734547 +0000 [coolwsd] INF WSD initialization complete: setting log-level to [warning] as configured.| wsd/COOLWSD.cpp:5269
Ready to accept connections on port 9980.

```

I only see the requests in the cloud-access Log in Nginx. Office Log nothing, Docker Logs nothing. Nextcloud docker Log only one entry while click on the file in webgui.

* * *

Moment! The Link is not complete https:/office.

My Nginx Config may wrong.  
He got only host, not server name.  
So i edit the Config:

```auto
location ~ / {
    proxy_pass http://office;
    proxy_set_header Host $server_name;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header User-Agent $http_user_agent;
	proxy_hide_header Upgrade;

```

Now i get this while opening:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/2/5/2506a72d28d073c7994a8eef8e1eeadb22a5edf8.png)

The link is identical:  
 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/c/4/c4275fb1e7448e2dcb4b92a7e634a6b519507f7c.png)

I dont see only one token (nextcloud log while open the file) but i cant compare, cause the office log is empty

I get this Errors in the Browser:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/6/f/6fbe72995518bfb2d11ce9efaec46288b91aa0cb.png)

And this:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/8/6/863b5727a19be97ac5e8f34e7f7ba22489ab1f0a.png)

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [November 9, 2022, 10:59am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/19 "2022-11-09T10:59:10Z")

</div>

> [@corin.corvus](#):
>
> Moment! The Link is not complete https:/office.

could be the reason.

take a look at the XML doc you get from `https://office.domain/hosting/discovery` you will see something

 ![image](https://help.nextcloud.com/uploads/default/original/3X/f/5/f56c3b4a28e6a0941ec0075f89d2f194458a2055.png)

if you don’t see full name there your Collabora container is not aware of it’s public DNS name and generates wrong URLs… please double check you docker-compose config:

```auto
    environment:
      - VIRTUAL_HOST=${COLLABORA_FQDN}

```

VIRTUAL\_HOST describes public domain name the Collabora container (reverse proxy listener)

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://help.nextcloud.com/letter_avatar/corin.corvus/32/6_449c533f586939b6e5f246632a46421f.png) [@corin.corvus](https://help.nextcloud.com/u/corin.corvus)\
**Post date:** [November 9, 2022, 11:08am UTC](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201/20 "2022-11-09T11:08:35Z")

</div>

The discovery looks fine:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/a/8/a86115b773897ff2b576475536a472558eaf3100.png)

This XML file does not appear to have any style information associated with it. The document tree is shown below.

```auto
<wopi-discovery>
<net-zone name="external-http">
<!-- Writer documents -->
<app favIconUrl="https://office.domain/browser/b639546/images/x-office-document.svg" name="writer">
<action default="true" ext="sxw" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="odt" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="fodt" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<!-- Text template documents -->
<action default="true" ext="stw" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="ott" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<!-- MS Word -->
<action default="true" ext="doc" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="dot" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<!-- OOXML wordprocessing -->
<action default="true" ext="docx" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="docm" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="dotx" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="dotm" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<!-- Others -->
<action default="true" ext="wpd" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="pdb" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="hwp" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="wps" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="wri" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="lrf" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="mw" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="rtf" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="txt" name="edit" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="fb2" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="cwk" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="pages" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="abw" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
<action default="true" ext="602" name="view" urlsrc="https://office.domain/browser/b639546/cool.html?"/>
</app>
<app name="writer-global">

```

i add VIRTUAL\_HOST to the Envionments now for beeing safe. After recreating same issue 😕

[Next page](https://help.nextcloud.com/t/nextcloud-in-docker-with-collabora-code/149201.md?page=2)
