# How to start the document server on Linux

**URL:** https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317
**Category:** Docs
**Tags:** linux, install
**Created:** [20 December 2023 14:13 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317 "2023-12-20T14:13:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [20 December 2023 14:13 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/1 "2023-12-20T14:13:45Z")

</div>

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](https://pastebin.com/Kq0CZKD4)

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](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.

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [21 December 2023 09:35 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/2 "2023-12-21T09:35:26Z")

</div>

Hello @itcihef

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

---

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [21 December 2023 09:47 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/3 "2023-12-21T09:47:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [22 December 2023 08:05 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/4 "2023-12-22T08:05:32Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [4 January 2024 14:51 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/5 "2024-01-04T14:51:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [10 January 2024 11:11 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/6 "2024-01-10T11:11:12Z")

</div>

> [@itcihef](#):
>
> Should I change the default ONLYOFFICE Docs port ? But then, how do I restart Document server to take it into consideration ?

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`.

---

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [16 January 2024 13:42 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/7 "2024-01-16T13:42:33Z")

</div>

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:

```auto
# 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](https://api.onlyoffice.com/editors/nextcloud).

- 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?

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [22 January 2024 10:18 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/8 "2024-01-22T10:18:38Z")

</div>

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/`.

---

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [24 January 2024 16:18 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/9 "2024-01-24T16:18:21Z")

</div>

**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?

---

<div class="post-metadata">

### Author: ![itcihef](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@itcihef](https://community.onlyoffice.com/u/itcihef)
#### Post date: [25 January 2024 10:22 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/10 "2024-01-25T10:22:37Z")

</div>

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:

```auto
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:

```auto
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:

```auto
-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?

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [29 January 2024 08:58 UTC](https://community.onlyoffice.com/t/how-to-start-the-document-server-on-linux/7317/11 "2024-01-29T08:58:33Z")

</div>

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:

> **[GitHub - ONLYOFFICE/document-server-proxy: Common setting for Document Server...](https://github.com/ONLYOFFICE/document-server-proxy/tree/master)**
>
> master

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