ONLYOFFICE / onlyoffice-nextcloud

The app which enables the users to edit office documents from Nextcloud using ONLYOFFICE Document Server, allows multiple users to collaborate in real time and to save back those changes to Nextcloud
GNU Affero General Public License v3.0
564 stars 161 forks source link

Doesn't work, but why? #3

Closed sinitcin closed 6 years ago

sinitcin commented 6 years ago

Hello!

I use the docker container:

sudo docker run -i -t -d -p 8008:80 -p 8009:443 --restart=always -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data  onlyoffice/documentserver

And call:

openssl genrsa -out onlyoffice.key 2048
openssl req -new -key onlyoffice.key -out onlyoffice.csr
openssl x509 -req -days 365 -in onlyoffice.csr -signkey onlyoffice.key -out onlyoffice.crt
mkdir -p /app/onlyoffice/DocumentServer/data/certs
cp onlyoffice.key /app/onlyoffice/DocumentServer/data/certs/
cp onlyoffice.crt /app/onlyoffice/DocumentServer/data/certs/
cp dhparam.pem /app/onlyoffice/DocumentServer/data/certs/
chmod 400 /app/onlyoffice/DocumentServer/data/certs/onlyoffice.key
sudo docker restart onlyoffice/documentserver

After I pointed in the browser line ServerIP: 8009 and saw on the page Document Server is running. Okay, go to NextCloud and open integration app, in inputbox Address of the document editing service i typed ServerIP: 8009 and click on button Save. And i view error message An error occurred while trying to connect (Request error or timeout).

Can i fix this error? Thanks!

sinitcin commented 6 years ago

is there anyone here?

alexanderonlyoffice commented 6 years ago

Hello @sinitcin, please specify some additional information:

  1. OS of the server where Document Server is installed;
  2. Are ONLYOFFICE Document Server and Nextcloud installed on the same server or on different ones?
  3. Try to disable SSL certificate validation by the Document Server. Enter the container and open /etc/onlyoffice/documentserver/default.json, find the following string "rejectUnauthorized": true and change its value to false. Close the config and restart services of the Document Server supervisorctl restart all
sinitcin commented 6 years ago
  1. Ubuntu server 17.10
  2. The ONLYOFFICE Document Server and Nextcloud installed on the one server.
$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                                         NAMES
24ce192cb8ce        onlyoffice/documentserver   "/bin/sh -c 'bash -C…"   20 hours ago        Up 19 hours         0.0.0.0:8008->80/tcp, 0.0.0.0:8009->443/tcp   mystifying_hamilton

$ docker exec -it mystifying_hamilton bash

# nano /etc/onlyoffice/documentserver/default.json
// After change value "rejectUnauthorized" to false

# supervisorctl restart all
onlyoffice-documentserver:metrics: stopped
onlyoffice-documentserver:spellchecker: stopped
onlyoffice-documentserver:gc: stopped
onlyoffice-documentserver:docservice: stopped
onlyoffice-documentserver:converter: stopped
onlyoffice-documentserver:metrics: started
onlyoffice-documentserver:spellchecker: started
onlyoffice-documentserver:gc: started
onlyoffice-documentserver:docservice: started
onlyoffice-documentserver:converter: started

# exit

$ docker restart mystifying_hamilton

In only-office integration app i view error An error occurred while trying to connect (Request error or timeout)..

And my native language is not English, I'm looking through error messages in Russian and then translating it into English.

sinitcin commented 6 years ago

And url i use is : https://127.0.0.1:8009/

sinitcin commented 6 years ago

And only-office integration app i installing from tab applications, not from git repo.

sinitcin commented 6 years ago

You can visit document-server welcome page https://синицын.рус:8009/welcome/

alexanderonlyoffice commented 6 years ago

@sinitcin, please try to use address with the domain name https://синицын.рус:8009/welcome/ in address settings of ONLYOFFICE integration app in NC.

sinitcin commented 6 years ago

@alexanderonlyoffice Можно по русски? В общем, не помогло, попробовал за одно и с адресом https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/, результат такой же При попытке соединения возникла ошибка (Ошибка запроса или таймаут)

translate: did not help.

alexanderonlyoffice commented 6 years ago

@sinitcin, убедитесь, что NC доступен для сервера документов. Зайдите в контейнер с сервером документов и выполните команду wget https://nextcloud_address и попробуйте также с хоста проверить доступность сервера документов wget https://documentserver_address

Пришлите, пожалуйста, скриншот вывода команды.

Можно также попробовать отключить верификацию SSL сертификата в NC. Доабвьте секцию, указанную ниже, в конфиг NC:

'onlyoffice' =>
  array (
    'verify_peer_off' => TRUE,
  )
sinitcin commented 6 years ago

Зайдите в контейнер с сервером документов и выполните команду wget https://nextcloud_address

Выполняю, файл качает

$ docker exec -it mystifying_hamilton bash
root@24ce192cb8ce:/# wget https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
--2018-08-22 12:19:52--  https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
Resolving синицын.рус (xn--h1aaobq7a9a.xn--p1acf)... 83.217.206.196
Connecting to синицын.рус (xn--h1aaobq7a9a.xn--p1acf)|83.217.206.196|:8009... co                                                                                                                                                             nnected.
ERROR: cannot verify xn--h1aaobq7a9a.xn--p1acf's certificate, issued by ‘O=Inter                                                                                                                                                             net Widgits Pty Ltd,L=Home,ST=Moscow,C=RU’:
  Self-signed certificate encountered.
    ERROR: certificate common name ‘’ doesn't match requested host name ‘xn--h1a                                                                                                                                                             aobq7a9a.xn--p1acf’.
To connect to xn--h1aaobq7a9a.xn--p1acf insecurely, use `--no-check-certificate'                                                                                                                                                             .

# wget --no-check-certificate https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
--2018-08-22 12:20:56--  https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
Resolving синицын.рус (xn--h1aaobq7a9a.xn--p1acf)... 83.217.206.196
Connecting to синицын.рус (xn--h1aaobq7a9a.xn--p1acf)|83.217.206.196|:8009... connected.
WARNING: cannot verify xn--h1aaobq7a9a.xn--p1acf's certificate, issued by ‘O=Internet Widgits Pty Ltd,L=Home,ST=Moscow,C=RU’:
  Self-signed certificate encountered.
    WARNING: certificate common name ‘’ doesn't match requested host name ‘xn--h1aaobq7a9a.xn--p1acf’.
HTTP request sent, awaiting response... 200 OK
Length: 4592 (4.5K) [text/html]
Saving to: ‘index.html’

index.html                                                  100%[========================================================================================================================================>]   4.48K  --.-KB/s    in 0s

2018-08-22 12:20:56 (155 MB/s) - ‘index.html’ saved [4592/4592]

/# ls
app  bin  boot  dev  etc  home  index.html  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
/# rm index.html

и попробуйте также с хоста проверить доступность сервера документов wget https://documentserver_address


$  wget --no-check-certificate https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
--2018-08-22 15:22:11--  https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/
Resolving xn--h1aaobq7a9a.xn--p1acf (xn--h1aaobq7a9a.xn--p1acf)... 127.0.1.1
Connecting to xn--h1aaobq7a9a.xn--p1acf (xn--h1aaobq7a9a.xn--p1acf)|127.0.1.1|:8009... connected.
WARNING: cannot verify xn--h1aaobq7a9a.xn--p1acf's certificate, issued by ‘O=Internet Widgits Pty Ltd,L=Home,ST=Moscow,C=RU’:
Self-signed certificate encountered.
WARNING: certificate common name ‘’ doesn't match requested host name ‘xn--h1aaobq7a9a.xn--p1acf’.
HTTP request sent, awaiting response... 200 OK
Length: 4592 (4,5K) [text/html]
Saving to: ‘index.html’

index.html 100%[========================================================================================================================================>] 4,48K --.-KB/s in 0s

2018-08-22 15:22:11 (784 MB/s) - ‘index.html’ saved [4592/4592]


> Доабвьте секцию, указанную ниже, в конфиг NC:

Если я Вас правильно понял, то конфиг NC этот файл - /var/www/nextcloud/config/config.php

<?php $CONFIG = array ( 'instanceid' => 'oc6vzfjy5a5a', 'passwordsalt' => 'lJtIHKpDGgGhnaLWMYD7SNOuvj9UZk', 'secret' => '12345', 'trusted_domains' => array ( 0 => 'cloud.xn--h1aaobq7a9a.xn--p1acf', ), 'memcache.local' => '\OC\Memcache\APCu', 'memcache.distributed' => '\OC\Memcache\Memcached', 'memcachedservers' => array ( 0 => array ( 0 => 'localhost', 1 => 11211, ), ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => 'https://cloud.xn--h1aaobq7a9a.xn--p1acf', 'dbtype' => 'mysql', 'version' => '13.0.5.2', 'dbname' => '12345', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc', 'dbuser' => '12345', 'dbpassword' => '12345', 'installed' => true, 'maintenance' => false, 'log_type' => 'syslog', 'logfile' => '', 'loglevel' => '3', 'logdateformat' => 'F d, Y H:i:s', 'theme' => '', 'onlyoffice' => array ( 'verify_peer_off' => TRUE, ) );


Дальше перезагружаю апач и снова указываю адрес к document-server, после жму `Сохранить`
![alt text](https://cloud.xn--h1aaobq7a9a.xn--p1acf/index.php/apps/files_sharing/ajax/publicpreview.php?x=1920&y=656&a=true&file=%25D0%259E%25D1%2588%25D0%25B8%25D0%25B1%25D0%25BA%25D0%25B0NC.png&t=abztwg237FcGWHk&scalingup=0)
И видим снова ошибку около заголовка окна. NC кстати  работает у меня через Apache ReverseProxy если это как-то влияет?
sinitcin commented 6 years ago

На всякий случай ещё напишу конфиг апача:

<VirtualHost *:80>
    ServerName cloud.xn--h1aaobq7a9a.xn--p1acf
    DocumentRoot /var/www/nextcloud/

    ServerAdmin webmaster@localhost
    <Directory /var/www/nextcloud>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    </Directory>

    RewriteEngine On
    <IfModule mod_rewrite.c>
            Options +FollowSymLinks
    </IfModule>
    RewriteCond %{SERVER_NAME} =cloud.xn--h1aaobq7a9a.xn--p1acf
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>

                SSLEngine ON
                ServerName cloud.xn--h1aaobq7a9a.xn--p1acf:443

                DocumentRoot /var/www/nextcloud

                ServerAdmin      webmaster@localhost
                Header always set Strict-Transport-Security "min-age=15552000; max-age=31536000; includeSubDomains"
                Alias /nextcloud "/var/www/nextcloud/"

                <Directory /var/www/nextcloud/>
                        Options +FollowSymlinks
                        AllowOverride All

                        <IfModule mod_dav.c>
                                Dav off
                        </IfModule>

                        SetEnv HOME /var/www/nextcloud
                        SetEnv HTTP_HOME /var/www/nextcloud
                </Directory>

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

                ServerAlias cloud.xn--h1aaobq7a9a.xn--p1acf
                Include /etc/letsencrypt/options-ssl-apache.conf
                SSLCertificateFile /etc/letsencrypt/live/cloud.xn--h1aaobq7a9a.xn--p1acf/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/cloud.xn--h1aaobq7a9a.xn--p1acf/privkey.pem
        </VirtualHost>
</IfModule>
sinitcin commented 6 years ago

Может есть возможность посмотреть логи onlyoffice?

mr-bolle commented 6 years ago

@sinitcin you can check the onlyoffice log with follow command

sinitcin commented 6 years ago

@mr-bolle Oh, that is how it should be?

Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
Waiting for connection to the localhost host on port 5672
 * Starting PostgreSQL 9.5 database server                               [ OK ]
 * Starting RabbitMQ Messaging Server rabbitmq-server                    [ OK ]
Starting redis-server: redis-server.
Starting supervisor: supervisord.
 * Starting nginx nginx                                                  [ OK ]
Generating AllFonts.js, please wait...Done
onlyoffice-documentserver:docservice: stopped
onlyoffice-documentserver:docservice: started
onlyoffice-documentserver:converter: stopped
onlyoffice-documentserver:converter: started
 * Reloading nginx configuration nginx                                   [ OK ]
alexanderonlyoffice commented 6 years ago

Hello @sinitcin, we reproduced the issue on our side. The problem is in HTTPS. If you use addresses only with HTTP protocol everything should work.

sinitcin commented 6 years ago

@alexanderonlyoffice Можете описать подробнее, по HTTP у меня вообще не работает =( Без указания адреса редактирования документов та же самая ошибка.

1 2 3

sinitcin commented 6 years ago

Do not forget about me =( The problem is not solved.

ibnpetr commented 6 years ago

The certificate cannot be validated in the container with Document Server To connect to xn--h1aaobq7a9a.xn--p1acf insecurely, use `--no-check-certificate' wget --no-check-certificate https://xn--h1aaobq7a9a.xn--p1acf:8009/welcome/

Please disable the node.js certificate check in the Document Server following the insctrustions posted here https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/96#issuecomment-405180858

sinitcin commented 6 years ago

@ibnpetr Sorry, but I already tried https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/3#issuecomment-414944028

And this not help me.

flaminestone commented 6 years ago

Hello @sinitcin At first, if you want to use documentserver and nextcloud with apache, you need to use proxy for documentserver proxy too. In this case, using 8008:80 ports will be enough sudo docker run -i -t -d -p 8008:80 --restart=always onlyoffice/documentserver Then, change your apache configuration for using virtual path like this https://github.com/ONLYOFFICE/document-server-proxy/blob/master/apache/proxy-to-virtual-path.conf I think, you config will be look like this:

<VirtualHost *:80>
    ServerName cloud.xn--h1aaobq7a9a.xn--p1acf
    DocumentRoot /var/www/nextcloud/

    ServerAdmin webmaster@localhost
    <Directory /var/www/nextcloud>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    </Directory>

    RewriteEngine On
    <IfModule mod_rewrite.c>
            Options +FollowSymLinks
    </IfModule>
    RewriteCond %{SERVER_NAME} =cloud.xn--h1aaobq7a9a.xn--p1acf
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>

                SSLEngine ON
                ServerName cloud.xn--h1aaobq7a9a.xn--p1acf:443

                DocumentRoot /var/www/nextcloud

                ServerAdmin      webmaster@localhost
                Header always set Strict-Transport-Security "min-age=15552000; max-age=31536000; includeSubDomains"
                Alias /nextcloud "/var/www/nextcloud/"

                <Directory /var/www/nextcloud/>
                        Options +FollowSymlinks
                        AllowOverride All

                        <IfModule mod_dav.c>
                                Dav off
                        </IfModule>

                        SetEnv HOME /var/www/nextcloud
                        SetEnv HTTP_HOME /var/www/nextcloud
                </Directory>

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

                ServerAlias cloud.xn--h1aaobq7a9a.xn--p1acf
                Include /etc/letsencrypt/options-ssl-apache.conf
                SSLCertificateFile /etc/letsencrypt/live/cloud.xn--h1aaobq7a9a.xn--p1acf/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/cloud.xn--h1aaobq7a9a.xn--p1acf/privkey.pem

                Define VPATH /documentserver
                Define DS_ADDRESS localhost:8008

                <Location ${VPATH}>
                Require all granted
                SetEnvIf Host "^(.*)$" THE_HOST=$1
                RequestHeader setifempty X-Forwarded-Proto https
                RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
                 RequestHeader edit X-Forwarded-Host (.*) $1${VPATH}
                 ProxyAddHeaders Off
                </Location>

                ProxyPassMatch ^\${VPATH}(.*)(\/websocket)$ "ws://${DS_ADDRESS}/$1$2"
                ProxyPass ${VPATH} "http://${DS_ADDRESS}"
                ProxyPassReverse ${VPATH} "http://${DS_ADDRESS}"

        </VirtualHost>
</IfModule>

Then, add https://nextcloud_address/documentserver to nextcloud settings

sinitcin commented 6 years ago

Thank you, i try.

p.s. Не много странно писать на английском, когда почти все в топике прекрасно понимают русский язык. Может какой либо раздел помощи для русско-язычной аудитории сделали бы?

flaminestone commented 6 years ago

@sinitcin I try to describe answer for all people, who to face a problem like this. Not only for Russians.

sinitcin commented 6 years ago

@flaminestone Youre config is work fine! Big thanks you!

solus7 commented 5 years ago

Добрый день! Та же самая проблема, только nextcloud установлен через snap, и поменять что то в конфиге apache не предоставляется возможным, как быть в этой ситуации? Document Server работает нормально. Спасибо!

sinitcin commented 5 years ago

Ну т.е. как я и говорил, что лучше на русском сделать поддержку, больше пользы будет. Иностранцам которым надо решить проблему смогут и через гугл транслейт перевести обсуждения.

sinitcin commented 5 years ago

Всем привет, кстати!

flaminestone commented 5 years ago

If you want to have a conversation in Russian, you can ask a question on our forum. No one will be able to find this question unless it is asked in English. It doesn't matter how you installed Nextcloud. You need to change proxy config, not apache from Nextcloud

sinitcin commented 5 years ago

@flaminestone Да бред это всё, ни кто в гитхабе не ищет, просто кому надо тот создаст новый issue.

flaminestone commented 5 years ago

@sinitcin, this issue can be found on Google not only on GitHub. I do not want to teach you using internet). You can use any language for your issues. Good luck waiting for answer

sinitcin commented 5 years ago

@flaminestone Очень рад, что до Вас так и не дошло. Ну и дальше пишите на английском ради полтора клиента и нуля PR от них

РукаЛицо

ShockwaveNN commented 5 years ago

@sinitcin We are sorry to disappoint you. We are sure, that your PR activity will be great for us, but github is not a forum, but a community of developers. And English - is De facto standard for discussions in developer community. I don't think you be happy to read some chinese or arabic text on github and using Google Translate to understand it. We are ready to help and discuss any problem in russian on forum, on vk.com or by support@onlyoffice.com, but we don't think it's possible on github.com

Очень жаль что так получилось. Уверен, что вклад в PR от вас был бы крайне значителен, но github это не форум, а сообщество разработчиков. А стандарт-де-факто в общении разработчиков - это английский язык. Думаю вам было бы не очень комфортно читать сообщения на китайском и переводить их через Google Translate. Мы готовы пообщаться по поводу проблем по-русски на форуме, в вконтакте или по support@onlyoffice.com, но считаем что на github это недопустимо.

solus7 commented 5 years ago

@ShockwaveNN Не хочу вступать в спор. Но все таки мне кажется, что это сервис не только для разработчиков, но и для пользователей. Не все к сожалению хорошо владеют иностранными языками. Мне не сложно пользоваться переводчиком, но вам же самим будет сложнее понять о чём идёт речь.

solus7 commented 5 years ago

Well, please prompt all. How to solve my problem? I searched google for advice, but I didn’t find anything sensible, so I’m writing to you. it is not clear why the integration with nexcloud does not work host: port?

flaminestone commented 5 years ago

You do not need to change nextcloud apache settings. Use proxy for nextcloud and editors (doc). My case:

snap install nextcloud
snap set nextcloud ports.http=81
docker run -itd -p 8008:80 onlyoffice/documentserver

Now onlyoffice editors will work on port 8008, and nextcloud will work on port 81. Then add proxy server. All proxy config examples are placed in our repo https://github.com/ONLYOFFICE/document-server-proxy

For example, nginx config will look like this:

map $http_upgrade $proxy_connection {
    default upgrade;
    "" close;
}

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $http_host/editors;
proxy_set_header X-Forwarded-Proto $scheme;

server {
        listen 80;
        location / {
                proxy_pass_header   Server;
                proxy_set_header    Host $host;
                proxy_set_header    X-Real-IP $remote_addr;
                proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header    X-Forwarded-Proto $scheme;
                proxy_pass          http://ip:81/;
        }
        location /editors/ {
            proxy_pass http://ip:8008/;
        }
}

After that, install onlyoffice integration app from nextcloud appstore, and add path to editors to settings (http://ip/editors)