How to start the document server on Linux

Hello. I am trying to install ONLYOFFICE Docs Community Edition for Debian.

Document Server version: 7.5.1-23
Installation of the Document Server: deb.
OS: Debian 12.4.
uname -a: 6.1.0-16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux

  • I followed the install doc.
  • I launched /usr/bin/documentserver-letsencrypt.sh
  • /etc/nginx files point to /etc/onlyoffice/documentserver/nginx files.
  • See my /etc/nginx/sites-enabled/ds.conf : /etc/nginx/sites-enabled/ds.conf - Pastebin.com

On /etc/hosts I added my domain at the end of the line

127.0.0.1 localhost

So I can use the domain name in my tries and point to the right localhosted website (because I host a couple of other ones).

But the problems are:

  • No documentserver runs on localhost:8000 Shouldn’t it be running? I don’t know how to start it.
  • curl https://onlyoffice.domain.tld => 302 Found but 403 Forbidden when browsed from eww Emacs.
  • /healthcheck => 502 Bad Gateway
  • /welcome => 502 Bad Gateway

Thanks for your help.

Hello @itcihef

May I know the guide that you’re following to install ONLYOFFICE Docs? Can you provide link to it?

Sure! I removed the link because new users are restricted in number of links :stuck_out_tongue_winking_eye: https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx

I believe it is better to start everything over. Please follow the guide but only to install Document Server, i.e. without switching to HTTPS or making any config changes. Once installed, navigate to http://localhost to see if it is working.


By the way, are there any other applications are running on the server that may occupy any ports?

Should I change the default ONLYOFFICE Docs port ? But then, how do I restart Document server to take it into consideration ?

The following servers are running:

  • nginx on 80 & 443
  • mariadb on 3306
  • redis on 6379
  • postgresql on 5432

You should change the port for ONLYOFFICE Docs (Document Server) in case there other applications running on this port. Keep in mind, that in order to run it on different port you have to uninstall the package and run it again specifying the port you what to use. The guide you’ve mentioned described the procedure of changing Document Server port in Changing the default ONLYOFFICE Docs port section.

In general, to understand better the cause of your situation, considering that you didn’t make any changes and don’t have any other applications running on necessary ports, please share logs of Document Server for analysis. Logs are located in /var/log/onlyoffice/documentserver.

I think I understood the architecture. Here are my steps:

  • I installed the onlyoffice-documentserver Debian’s package. So now dpkg -l | grep documentserver returns:
    ii onlyoffice-documentserver 7.5.1-23 amd64 Online editors for text documents, spreadsheets, and presentations
  • Under my nginx /etc/nginx it creates the appropriate conf.d/ds.conf and includes/ds-*.conf and includes/http-common.conf correctly set files.
  • I created /etc/nginx/sites-enable/proxy-ds config file so:
# SOURCE: https://github.com/ONLYOFFICE/document-server-proxy/blob/master/nginx/proxy-https-to-http.conf

## Normal HTTP host
server {
    listen 0.0.0.0:80;
    listen [::]:80;

    server_name onlyoffice.domain.org;
    server_tokens off;

    ## Redirects all traffic to the HTTPS host
    return 301 https://$server_name:443$request_uri;
}

server {
    listen 0.0.0.0:443 ssl;
    listen [::]:443 ssl;

    server_name onlyoffice.domain.org;
    server_tokens off;
    root /usr/share/nginx/html;

    ## Strong SSL Security
    ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
    ssl_certificate /etc/letsencrypt/live/onlyoffice.domain.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/onlyoffice.domain.org/privkey.pem;
    ssl_verify_client off;

    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_session_cache  builtin:1000  shared:SSL:10m;

    ssl_prefer_server_ciphers   on;

    ## [Optional] Before enabling Strict-Transport-Security headers, ensure your server is properly configured for SSL.
    ## This directive informs the browser to always use HTTPS. For more info see:
    ## - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;

    include includes/ds-*.conf;
}

Result of this first phase: I can browse https://onlyoffice.domain.org where it basically says: “ONLYOFFICE Docs Community Edition installed”. Alright.

Now, in order to integrate it into my nextcloud instance, I follow ONLYOFFICE Api Documentation - Nextcloud ONLYOFFICE integration app.

  • From /etc/onlyoffice/documentserver/local.json I copied the services.CoAuthoring.secret.inbox.string value into https://nextcloud.domain.org/settings/admin/onlyoffice’s “Secret key (leave blank to disable)” field. There I also wrote https://onlyoffice.domain.org as “Document Editing Service address”. I saved.

Now I am checking the connection with occ onlyoffice:documentserver --check and it returns: Error connection: Error occurred in the document service: Unknown error.

What could have gone wrong?

Does it return any error when you are attempting to save connector app settings via Nextcloud interface? Please try it and share a screenshot.

Also, after connecting attempt please share logs of Document Server. Those are located in /var/log/onlyoffice/.

PARTIAL SOLVING…

Yes, when I save it says:

Erreur durant la tentative de connexion (Une erreur s’est produite dans le service de document: Unknown error) (version 7.5.1.23)

Thank you for the location. Indeed, /var/log/onlyoffice/documentserver/docservice/out.log was appended with the following errors:

[2024-01-24T14:14:25.429] [WARN] [localhost] [conv_check_359861432_docx] [userId] nodeJS - sqlQuery error sqlCommand: INSERT INTO task_result (tenant, id, status, statu: error: relation “task_result” does not exist
at /snapshot/server/build/server/DocService/node_modules/pg-pool/index.js:45:11
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
[2024-01-24T14:14:25.429] [ERROR] [localhost] [conv_check_359861432_docx] [userId] nodeJS - convertRequest error: error: relation “task_result” does not exist
at /snapshot/server/build/server/DocService/node_modules/pg-pool/index.js:45:11
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)

So this put me on the way of empty Postgresql database. I don’t know why it couldn’t write into it. So I recreated it and reinstalled onlyoffice-documentserver without removing the database when it asked it too (of course).

… BUT STILL

After this reinstall, when I validate in nextcloud, the error changed to:

Server error: GET https://onlyoffice.crieppam.fr/healthcheck resulted in a 502 Bad Gateway

And indeed: netstat -anp| grep 8000 doesn’t return anything: docservice is not listening.

systemctl status ds-* seems ok:

● ds-converter.service - Docs Converter
Loaded: loaded (/lib/systemd/system/ds-converter.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-01-24 17:07:56 CET; 6min ago
Main PID: 794 (converter)
Tasks: 20 (limit: 38183)
Memory: 167.6M
CPU: 2.388s
CGroup: /system.slice/ds-converter.service
├─ 794 /var/www/onlyoffice/documentserver/server/FileConverter/converter
└─1041 /var/www/onlyoffice/documentserver/server/FileConverter/converter /snapshot/server/build/server/FileConverter/sources/convertermaster.js

Jan 24 17:07:56 myhostname systemd[1]: Started ds-converter.service - Docs Converter.

● ds-metrics.service - Docs Metrics
Loaded: loaded (/lib/systemd/system/ds-metrics.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-01-24 17:07:54 CET; 6min ago
Main PID: 681 (statsd ./config)
Tasks: 10 (limit: 38183)
Memory: 40.9M
CPU: 258ms
CGroup: /system.slice/ds-metrics.service
└─681 /var/www/onlyoffice/documentserver/server/Metrics/metrics ./config/config.js

Jan 24 17:07:54 myhostname systemd[1]: Started ds-metrics.service - Docs Metrics.

● ds-docservice.service - Docs Docservice
Loaded: loaded (/lib/systemd/system/ds-docservice.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-01-24 17:07:56 CET; 6min ago
Main PID: 796 (docservice)
Tasks: 10 (limit: 38183)
Memory: 135.9M
CPU: 2.337s
CGroup: /system.slice/ds-docservice.service
└─796 /var/www/onlyoffice/documentserver/server/DocService/docservice

Jan 24 17:07:56 myhostname systemd[1]: Started ds-docservice.service - Docs Docservice.

And debconf-show onlyoffice-documentserver shows 8000 as expected:

  • onlyoffice/db-pwd: (password omitted)
    onlyoffice/rabbitmq-pwd: (password omitted)
  • onlyoffice/docservice-port: 8000
  • onlyoffice/ds-port: 80
    onlyoffice/rabbitmq-user: guest
    onlyoffice/remove-db: false
  • onlyoffice/example-port: 3000
    onlyoffice/db-name: onlyoffice
  • onlyoffice/jwt-enabled: true
    onlyoffice/db-port:
  • onlyoffice/cluster-mode: false
  • onlyoffice/db-type: postgres
  • onlyoffice/jwt-header: Authorization
  • onlyoffice/jwt-secret: sPi4tNH0q8dehfhGfeCV6LDRtTDbPh8s
    onlyoffice/db-user: onlyoffice
    onlyoffice/plugins-enabled: true
    onlyoffice/rabbitmq-host: localhost
    onlyoffice/rabbitmq-proto: amqp
    onlyoffice/db-host: localhost

So now I am turning back to the initial question of my post: How do I start docserver? Why doesn’t it launch by itself? That’s weird because on another server of mine, docserver is running. I compared the above configs and the nginx proxy definition, and everything looks the same. Any idea?

Well, the apt purge onlyoffice-documentserver didn’t remove /var/www/onlyoffice. So that’s what I did. Again I saw a server password in the logs, so I dropped and created the psql database anew. At last, netstat -anp| grep 8000

tcp6 0 0 :::8000 :::* LISTEN 67847/docservice

I hope my “failing tutorial” can help out other people to make it work.

LAST (?) ERROR

While still having an eye on any docserver *.log and nginx’s proxy site config with the command find /var/log/onlyoffice/ -name "*.log" | xargs tail -F /usr/share/nginx/logs/proxy-ds-*.log (to be adapted for your case), I am checking the nextcloud onlyoffice connection with occ onlyoffice:documentserver --check. Here is the output:

Error connection: Client error: `GET https://onlyoffice.crieppam.fr/cache/files/data/conv_check_1452087875_docx/output.docx/check_1452087875.docx?md5=IRcVlEK6r5ylTeDAeBtKfg&expires=1706174602&filename=check_1452087875.docx` resulted in a `403 Forbidden` response:
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</c (truncated...)

My debugging thinking was: "Ok, this URL is caught by this includes/ds-docservice.conf rule:

location ~* ^(\/cache\/files.*)(\/.*) {
  alias /var/lib/onlyoffice/documentserver/App_Data$1;
  add_header Content-Disposition "attachment; filename*=UTF-8''$arg_filename";

  secure_link $arg_md5,$arg_expires;
  secure_link_md5 "$secure_link_expires$uri$secure_link_secret";

  if ($secure_link = "") {
    return 403;
  }

  if ($secure_link = "0") {
    return 410;
  }
}

Though ls -1l /var/lib/onlyoffice/documentserver/App_Data/cache/files/data/conv_check_1452087875_docx/output.docx returns:

-rw-r--r-- 1 ds ds 7859 Jan 25 10:08 /var/lib/onlyoffice/documentserver/App_Data/cache/files/data/conv_check_1452087875_docx/output.docx

(Let me mention that the ds user is member of the www-data group.)

I am wondering how the /check_1452087875.docx?md5=IRcVlEK6r5ylTeDAeBtKfg&expires=1706174602&filename=check_1452087875.docx part is matched by the rule…

Why do I have this error? Do you understand?

Wow, that’s quite a lot of actions you’ve done there. Anyway, now pretty much everything seems to be working. Since proxy is used in your environment, please check out examples of configs that we provide for most popular services:

By the way, did you make any changes to the configs of Document Server in the process?