# Nextcloud/collabora/nginx not working

**URL:** <https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710>\
**Category:** Installation & Configuration\
**Created:** [May 23, 2025, 8:56pm UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710 "2025-05-23T20:56:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wallage](https://avatars.discourse-cdn.com/v4/letter/w/f6c823/32.png) [@wallage](https://forum.collaboraonline.com/u/wallage)\
**Post date:** [May 23, 2025, 8:56pm UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710/1 "2025-05-23T20:56:23Z")

</div>

Hopefully I can explain my setup.

I am using cloudflare as a DNS server for my domain  
I have the following records

[nextcloud.example.com](http://nextcloud.example.com) for my nextcloud host  
[collabora.example.com](http://collabora.example.com) for my collabora CODE host  
both point to my server at home.  
This server is running Ubuntu with docker.  
Inside docker I have nginx as a reverse proxy to redirect the incomming request.  
all the scripts are shown below.

I can browse to nextcloud address, and nextcloud seems to be working properly.  
I have installed nextcloud office and configured it to contact through collabora address.  
The admin page of nextcloud office is showing the message “Collabora Online server is reachable”. I can create new office files inside the files app. The new file is being created.  
But when I want to open the file I get an error “Document loading failed  
Failed to load Nextcloud Office - please try again later”

docker-compose1

```auto
version: '3.8'

networks:
  my_network:
    external: true
    name: my_bridge_network

services:
  ng_nextcloud:
    container_name: ng_nextcloud
    networks:
      - my_network
    image: nextcloud
    ports:
      - 8080:80
    volumes:
      - ./appdata:/config
      - ./data:/data
    environment:
      - PUID=1000
      - PGID=1000
      - OVERWRITEHOST=nextcloud.example.eu
      - TZ=Europe/Amsterdam

  collabora:
    container_name: collabora_code
    networks:
      - my_network
    image: collabora/code
    ports:
      - "9980:9980"
    environment:
      - server_name=nextcloud.example.eu
    volumes:
      - ./coolwsd/coolwsd.xml:/etc/coolwsd/coolwsd.xml

```

docker-compose2

```auto
version: '3.8'

services:
  mariadb:
    image: mariadb
    networks:
      - my_network
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: ${mariadb_root_password}
      MYSQL_DATABASE: ${mariadb_db_name}
      MYSQL_USER: ${mariadb_user}
      MYSQL_PASSWORD: ${mariadb_password}
    volumes:
      - mariadb_data:/var/lib/mysql
    ports:
      - "3306:3306"
    restart: unless-stopped

  nginx:
    container_name: nginx
    networks:
      - my_network
    image: nginx
    volumes:
      - ./proxy/nginx.conf:/etc/nginx/conf.d/default.conf
      - ./proxy/.htpasswd:/zigbee2mqtt_htpasswd
      - ./ssl:/etc/nginx/certs:ro"
    ports:
      - "443:443"
    restart: unless-stopped

networks:
  my_network:
    driver: bridge
    name: my_bridge_network

volumes:
  mariadb_data:

```

nginx config

```auto
server {
  listen 443 ssl;
  ssl_certificate /etc/nginx/certs/www.example.eu.crt;
  ssl_certificate_key /etc/nginx/certs/www.example.eu.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  server_name nextcloud.example.eu;

  location / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade"; #syntax change here
    proxy_pass http://ng_nextcloud:80;
  }
}

#new collabora stuff
server {
 listen 443 ssl;
 server_name collabora.example.eu;

 ssl_certificate /etc/nginx/certs/www.example.eu.crt;
 ssl_certificate_key /etc/nginx/certs/www.example.eu.key;

 # static files
 location ^~ /browser {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }

 # WOPI discovery URL
 location ^~ /hosting/discovery {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }

 # Capabilities
 location ^~ /hosting/capabilities {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }

 # main websocket
 location ~ ^/cool/(.*)/ws$ {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }

 # download, presentation and image upload
 location ~ ^/(c|l)ool {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }

# Admin Console websocket
 location ^~ /cool/adminws {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }
}

```

---

<div class="post-metadata">

**Author:** ![wallage](https://avatars.discourse-cdn.com/v4/letter/w/f6c823/32.png) [@wallage](https://forum.collaboraonline.com/u/wallage)\
**Post date:** [May 24, 2025, 2:04pm UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710/2 "2025-05-24T14:04:16Z")

</div>

![chrome console](https://europe1.discourse-cdn.com/flex013/uploads/collaboraonline/original/2X/7/7e58d321fa0d672c42f4f88ba6250b9c97747ada.jpeg)

i tried some debugging in chrome and got to this point where i think i get an error from cloudflare. I am not very experienced in all this and don’t know what this means. this is the consolde output when i try to open a document from within the nextcloud “file” app.

---

<div class="post-metadata">

**Author:** ![wallage](https://avatars.discourse-cdn.com/v4/letter/w/f6c823/32.png) [@wallage](https://forum.collaboraonline.com/u/wallage)\
**Post date:** [May 24, 2025, 4:30pm UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710/4 "2025-05-24T16:30:16Z")

</div>

Also I noticed that the websockets do not work with the nginx config from the collabora webpage.

---

<div class="post-metadata">

**Author:** ![wallage](https://avatars.discourse-cdn.com/v4/letter/w/f6c823/32.png) [@wallage](https://forum.collaboraonline.com/u/wallage)\
**Post date:** [May 25, 2025, 8:19am UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710/5 "2025-05-25T08:19:50Z")

</div>

Yesterday I changed from the latest docker image of collabora/code to 24.04.12.4.1 and all of the sudden it works.  
Can someone explain way this would be the case? I am very happy though.

One thing I do notice is, when I create a new file, it’s is immediately created and opened. This always results in an error.  
If I wait a little and open the file from nextcloud ‘file’ app it opens correctly like the server needs some time to prepare the file…

---

<div class="post-metadata">

**Author:** ![wallage](https://avatars.discourse-cdn.com/v4/letter/w/f6c823/32.png) [@wallage](https://forum.collaboraonline.com/u/wallage)\
**Post date:** [May 25, 2025, 11:27am UTC](https://forum.collaboraonline.com/t/nextcloud-collabora-nginx-not-working/3710/6 "2025-05-25T11:27:11Z")

</div>

I tried different docker images but everyone \>= 24.04.13.1.1 seems to fail
