How to make OnlyOffice and Community Document Server from Nextcloud apps work with self-signed SSL certificate

I have running Nextcloud in docker-compose from this example docker-compose

sudo docker compose exec --user www-data app php occ  -V                                                                                                                                                      

Nextcloud 26.0.3

sudo docker compose exec --user www-data app php occ  app:list

- documentserver_community: 0.1.13
- onlyoffice: 7.8.0

OnlyOffice and Community Document work fine without SSL certificate

After that, I generate signed SSL certificate

OnlyOffice and Community Document work fine with signed SSL certificate

But in my case, I need to work with self-signed SSL certificate

But I still have the problem

sudo docker compose exec --user www-data app php occ onlyoffice:documentserver --check                                                                                                                        

Error connection: cURL error 7: Failed to connect to localhost port 443: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://localhost/apps/documentserver_community/healthcheck
curl --insecure  https://localhost/apps/documentserver_community/healthcheck                                                                                                                                  
true

I try to add to nextcloud/config/config.php

  'onlyoffice' =>array(
  'verify_peer_off'=>true
  ),

and also try add my certificate to nextcloud

sudo docker compose exec --user www-data app php occ  security:certificates                                                                                                                                   

+---------------+-------------+--------------------------+----------------+-----------+
| File Name     | Common Name | Organization             | Valid Until    | Issued By |
+---------------+-------------+--------------------------+----------------+-----------+
| localhost.crt |             | Internet Widgits Pty Ltd | March 12, 2029 |           |
+---------------+-------------+--------------------------+----------------+-----------+

Upvotes: 0

Views: 908

Answers (1)

Arny80Hexa
Arny80Hexa

Reputation: 17

1st way

Log into your onlyoffice container with:

docker exec -it <container> bash

and edit the config file /etc/onlyoffice/documentserver/default.json. Find the entry "rejectUnauthorized": true and set it to false:

},
      "requestDefaults": {
        "rejectUnauthorized": false
      }

After that, exit and restart container:

docker container <container> stop && docker container <container> start 

2nd way

ATTENTION: The Parameter must be set to true (not 'false')! It's a little bit confusing at this point.

The more elegant way is it to start the container directly with the parameter -e USE_UNAUTHORIZED_STORAGE=true. Example:

docker run -i -t -d -p 8888:80 -p 8443:443 --name=onlyoffice --restart=always -e USE_UNAUTHORIZED_STORAGE=true onlyoffice/documentserver:latest

Upvotes: 0

Related Questions