Nextcloud & Onlyoffice via Docker - can't connect on the same server

Hey there :slight_smile:

I’ve been trying to make works Nextcloud & OnlyOffice on the same server for the past few days without success.
Configuration :

  • Docker with Portainer,
  • Nextcloud (latest image available),
  • OnlyOffice (same as Nextcloud),
  • PostgreSQL (as the db of my nextcloud)
  • Nginx vanilla (non docker installed)

Everything’s installed on the same server. (18.04)
My server is a local server, with ALL port opened on my box in order for me to access it from anywhere.

Everything seems to be fine, my nextcloud is working properly as I was able to install it normally. Then, same as my Onlyoffice. When I go on my https://document.domain.something/ (My nextcloud & onlyoffice are both in https) I’m able to see :

Great, onlyoffice is working normally as well.
Now, when I try to connect my onlyoffice to my nextcloud I have :

**Error onlyoffice HealthcheckRequest on check error: cURL error 28: Connection timed out after 60000 milliseconds (see**

Funny thing is : if I try to connect to my OnlyOffice via another nextcloud on another server, it works ! I’m able to connect to my onlyoffice and open/create files with it. And If i try using it locally (with my 192.168.x.x:onlyofficeport) it’s working too, but it doesn’t when I try it by using my https://domain.something/ .

So far I’ve tried :

  • looking at logs, but nothing is showing any kind of problem,
  • reinstalling everything from scratch,
  • create a new docker network and connecting all of my containers to it, but since there’re already - connected via bridge this shouldn’t be an issue,
  • Adding the

‘onlyoffice’ => array ( ‘verify_peer_off’ =>TRUE, ),

to my nextcloud, withtout any success either.

  • Connect my onlyoffice to another nextcloud server, somewhere else It works.

I hope you guys can gelp :slight_smile:

1 Like

Anyone? :frowning:

Perhaps there is a DNS Rebind issue in the (dhcp) router.
In my Fritz!Box I had to enter all domains that are forwarded to my local network machines in the Tab ‘Network Settings’. At the bottom you see DNS Rebind Protection
I just entered the domain names and subdomains, one per line.
So there is a line ‘cloud.domain.ext’ and ‘office.domain.ext’.

Thanks for the answer, sadly, this didn’t solved it. Issue’s still here.
It almost seems like it’s not possible to have both (nextcloud and onlyoffice) on one and only one server…

your nextcloud server is inside a docker container or not ?

Yes it is, same container, same server

@syrosh any chance to run my playbook on your side? than you would get what want or your problem is outside your server. or you found a bug in my playbooks. that i’m happy to fix if i can.

please run it on a fresh ubuntu installation. not on the server where you setup your nextcloud. make backups and i’m not responsible. the usual disclaimer.

if you can read ansible/jinja2 you could just go through the playbook file and compare my config to yours.


didn’t see this. my playbook would setup traefik as ingress router/reverse proxy. sorry. it’s not exactly your setup.

there is no need for a domain: document.domain.something everything runs on nextcloud.domain.something and there is no need to run documentserver on https. unless someone explains to me why if you run everything on a single machine. for my understanding tls termination is done by traefik(me)/nginx.vanilla(you). the rest of the communication is machine internal only.

1 Like

I’ll try your playbook later today, thanks for replying :slight_smile:

I have exactly the same issue - i can reproduce your scenario.

When running nextcloud / onlyoffice on seperate servers, the Integration between those two works flawlessly.

When running nextcloud / onlyoffice on the same server, i get that “timeout”-issue and cannot save anything.

Did you find any solution on how to run both services on the same server via docker?

My setup:
-) Docker
-) Nginx-proxy (like traefik, containerized)
-) Nextcloud + “onlyoffce-intregration”-app (containerized)
-) Documentserver (containerized)
-) DB: mariadb (containerized)

@syrosh any chance you figured something out?

Thank you very much :slight_smile:

If you add the same network to all containers you should be able to address them by the host name whereby the host name is the name of the container.
See attached example.

That’s reassuring that you’re getting the same errors to be honest, I was seriously starting to think I was crazy !
Sadly, no, I didn’t find anything yet…

I’ve tried to put them on the same network aswell (in docker).
Sadly, it didn’t worked. Thanks for your input anyway!

I had a bug « a bit similar » : I could not save the Onlyoffice app settings in Nextcloud with NC and OO in 2 docker containers in the same machine (network mode bridge). My error message was a bit different : « bad health check » or « error while downloading the document being converted ».
I could resolve it with adding the local IP and Domain names of both nextcloud and only office in the « trusted domains » array in NC config.php : [Onlyoffice] Error while downloading the document file to be converted ou encore ici :
So now I can save the settings !
But I still can’t open OO documents : when I click on a .docx doc in Files for example it says « onlyoffice unreachable ».
I also found a page that could help :
@edvinkuric and @syrosh what did you put in the 3 server fields « external doc server », « internal doc server » and « internal NC server » ? It could help to understand the pb

I had a similar issue long time ago.

The problem I ran into was the fact, that the docker container couldn’t connect “outside” of its container directly to the host machine due to a DNS “problem” with docker.

My solution was the following:
I had to add to the docker run command to allow the docker container to connect outside of the container to the “host” running nextcloud in my linux.

Here my complete command

docker run -i -t -d -p 8443:443 --restart=always --name=OnlyOffice \
  -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice  \
  -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data  \
  -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
  -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver \
  -e JWT_ENABLED='true' \
  -w JWT_SECRET='SomeSuperSecretPassword'

JWT is set here, but for some reason the JWT token didn’t work for me in the Nextcloud backend.
Therefore i just left the JWT Token Password blank i the Nextcloud backend. is the IP address of my host machines “docker0” interface (for me) is the IP address of the docker containers “eth0” interface (for me)
It could be that you have a slightly different IP addresses (check with ip a)

Hope this helps

1 Like

Been a while since I’ve tried all this. Decided to try again today,I hopped that there would have been an update of some sort that would have fixed my problem.
Sadly, none of it.

Any update on your side?

Did you try to pass through the host ( with a specific port previously configured?

I use this method on my server but those are installations with packages not with docker.only

Thanks for you reply, sadly this didn’t helped.

I finally managed to make it work using this tutorial :

everything seems to finally be working fine !


Just to verify, your solution was to comment out the 301 redirect in the nginx.conf ?