====== OnlyOffice ======
OnlyOffice and NextCloud in Docker. Both proxied by NGINX rev proxy.
* NextCloud app is on https://nc.example.com
* OnlyOffice app is on https://nc.example.com/documentserver/
===== References =====
[[https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx|Installing ONLYOFFICE Docs Community Edition for Debian, Ubuntu, and derivatives]]
[[https://helpcenter.onlyoffice.com/installation/docs-community-proxy.aspx|Using ONLYOFFICE Docs behind the proxy]]
[[https://www.linuxbabe.com/ubuntu/integrate-nextcloud-onlyoffice|How to Integrate OnlyOffice with NextCloud on Ubuntu]]
===== NGINX config =====
Additional config lines for NextCloud virtual site config:
upstream docservice {
server 192.168.64.231:3077;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
server {
..
location /documentserver {
return 302 /documentserver/;
}
location ~ ^/web-apps/(.*) {
# rewrite ^ https://$server_name$request_uri? permanent;
return 302 /documentserver/web-apps/$1$is_args$args;
}
location /documentserver/ {
proxy_pass http://docservice/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/documentserver;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Based on hints from: [[https://github.com/ONLYOFFICE/document-server-proxy]]
===== docker-compose =====
[[https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud]]
[[https://hub.docker.com/r/onlyoffice/documentserver/]]
OnlyOffice network in Docker is configured:
* as 'onlyoffice' node on port 80 (internal linked services network)
* as TCP:3077 on Docker host (rev proxied by NGINX )
==== Test OnlyOffice server ====
Web page should be shown on link: [[https://nc.example.com/documentserver/welcome/]]
===== NextCloud =====
Install and enable `OnlyOffice` plugin.
Configure it as follows:
### Trusted domain
./occ config:system:get trusted_domains
# Put correct indexes in commands below:
./occ config:system:set trusted_domains 0 --value="nc.example.com"
# NC http port is exposed from Docker to host port 3007
./occ config:system:set trusted_domains 1 --value="host_ip:3007"
### OnlyOffice config
# OnlyOffice server URL:
./occ config:system:set onlyoffice DocumentServerUrl --value="https://nc.example.com/documentserver/"
# How OnlyOffice can reach NC:
./occ config:system:set onlyoffice StorageUrl --value="http://nc.grinn-global.com/"
# NOTE; it is possible to put external URL like above, but NC can communicate directly inside private Docker network
./occ config:system:set onlyoffice DocumentServerInternalUrl --value="https://onlyoffice/"
# And permit NC to communicate with local addresses
# Without this you can got error: Error when trying to connect (Host violates local access rules)
./occ config:system:set allow_local_remote_servers --value true --type bool