Skip to content

OnlyOffice Docker Installation

Download Installation Package

TIP

Before installing onlyoffice, you need to ensure that docker is installed on your server. If not installed, please refer to the Offline Docker Installation document.

bash
sudo wget https://repo.informat.cn/downloads/installer/onlyoffice/onlyoffice-install.zip

Install OnlyOffice

bash
sudo unzip onlyoffice-install.zip
sudo cd onlyoffice-install
sudo chmod +x install.sh
sudo ./install.sh

TIP

Explanation of startup command in install.sh: sudo docker run -i -t -d -p 9002:80
-p 20004:443
--env-file /data/onlyoffice/DocumentServer/data/env.properties
--restart=always
-v /data/onlyoffice/DocumentServer/logs:/var/log/onlyoffice
-v /data/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data
-v /data/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice
-v /data/onlyoffice/DocumentServer/db:/var/lib/postgresql
onlyoffice/documentserver-ee:7.1.1

-p 9002:80: OnlyOffice's 80 port is mapped to port 9002 on the host -p 20004:443: OnlyOffice's 443 port is mapped to port 20004 on the host Please ensure these two ports are allowed in the security group or firewall.

Check OnlyOffice Installation

Access via browser: http://ip:9002, OnlyOffice document page should appear

OnlyOffice Font Installation

Download Font Files

First, you need to download the font files you want to install. Then upload the font files to a specific directory on the server. You can refer to onlyoffice-chinese-fonts to download commonly used fonts. It is recommended to use mini_fonts.

Supports All TrueType/OpenType Fonts

  • TrueType: .ttf, .tte
  • OpenType: .otf, .otc, .ttf, .ttc

Install Fonts

TIP

For Docker-installed OnlyOffice, commands need to be executed inside the container.

  • Copy the font files to the /usr/share/fonts/ directory
bash
mv {font-file} /usr/share/fonts/
  • Enter the /usr/bin directory
bash
cd /usr/bin
  • Run the documentserver-generate-allfonts.sh file
bash
./documentserver-generate-allfonts.sh
  • Clear browser cache and reopen the page

Restart OnlyOffice Service

After font installation is complete, you may need to restart the OnlyOffice service for the new fonts to take effect. You can use the following command to restart the service:

bash
systemctl restart supervisord.service

Clear Browser Cache

Verify Font Installation

Open the OnlyOffice document editor (preview function) and check if the newly installed fonts appear in the font list.

OnlyOffice Common Issues

TIP

For Docker-installed OnlyOffice, commands need to be executed inside the container.

When the OnlyOffice preview service is not working properly, we need to troubleshoot errors through the relevant log files.

bash
# Enter the log directory
cd /var/log/onlyoffice/documentserver
# Monitor subsequent logs
tail -f **/*.log

Frontend shows "Your license has expired. Please update your license and refresh the page."

Get the MD5 of the license file and check if it is 8d289ecbf3c3afcc280fb7971ac120f2

bash
md5sum /var/www/onlyoffice/Data/license.lic

If the MD5 is incorrect or the file doesn't exist, please extract the Informat installation package to obtain the license.lic file. For example, if the Informat installation package is informat_next_2.23.zip

bash
unzip -d informat_next_2.23 informat_next_2.23.zip;
cp -vf ./informat_next_2.23/onlyoffice/license.lic /var/www/onlyoffice/Data/

Frontend shows "Failed to open preview file", F12 console shows

log
webSocket connection to 'ws://xxxxx/7.1.1-23/doc/xxxx/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

Modify the corresponding NGINX configuration to fix it:

bash
vi /etc/nginx/conf.d/ds.conf

# Add configuration at the appropriate location
server {
  listen 0.0.0.0:9002;
  listen [::]:9002 default_server;
  server_tokens off;
  
  # Added configuration
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header Host $http_host;
  
  include /etc/nginx/includes/ds-*.conf;
}
# Save file
:wq!

# Reload NGINX configuration
nginx -s reload

High server CPU usage, log shows "[AMQP] Error: Handshake terminated by server: 403"

Error message in logs:

log
[ERROR] nodeJS - [AMQP] Error: Handshake terminated by server: 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile."

If you encounter the above error message, please check if the RabbitMQ username and password are correct. When the RabbitMQ credentials are wrong, OnlyOffice will keep trying to connect to RabbitMQ, causing abnormal CPU resource usage.

bash
# Check if RabbitMQ username and password are correct and modify if necessary
vi /etc/onlyoffice/documentserver/local.json

# RabbitMQ configuration details, URL parameter explanation: amqp://username:password@hostname
"rabbitmq": {
    "url": "amqp://guest:guest@127.0.0.1"
}
# Save
:wq

# Restart service
systemctl restart supervisord

Log shows "invalid header token"

The response header of the requested link is incorrect.

bash
# Check the access link address in the log, usually the preview file download address, e.g., http://xxx/web0/file/field/xxxxx

# Access the corresponding link to get response header information
curl -I {error_access_link_from_log}

Check if the response header is valid. If not, please modify the corresponding header information on NGINX.

Frontend shows "Download failed"

The reason is that the file download timed out. By default, the timeout for OnlyOffice to download files is 2 minutes.

Solutions:

    1. Improve network speed
    1. Modify OnlyOffice configuration file, change the value of services.CoAuthoring.server.limits_image_download_timeout.wholeCycle parameter to 5m, then restart OnlyOffice

The format of the document security token is incorrect

Linux/Windows

  1. Open the local.json file using any available text editor:
    • For Linux - /etc/onlyoffice/documentserver/local.json
    • For Windows - %ProgramFiles%\ONLYOFFICE\DocumentServer\config\local.json
  2. Enable token validation by changing the value from false to true in the following three sections:
    • services.CoAuthoring.token.enable.browser
    • services.CoAuthoring.token.enable.request.inbox
    • services.CoAuthoring.token.enable.request.outbox
  3. Specify your own secret key by replacing the key values in the three sections with your own text string. The keys must be the same:
    • services.CoAuthoring.secret.inbox.string
    • services.CoAuthoring.secret.outbox.string
    • services.CoAuthoring.secret.session.string
json
{
  "services": {
    "CoAuthoring": {
      "token": {
        "enable": {
          "request": {
            "inbox": true,
            "outbox": true
          },
          "browser": true
        }
      },
      "secret": {
        "inbox": {
          "string": "yoursecret"
        },
        "outbox": {
          "string": "yoursecret"
        },
        "session": {
          "string": "yoursecret"
        }
      }
    }
  }
}
  1. Save the changes.
  2. Restart the service to make the configuration changes take effect:
shell
systemctl restart ds-converter ds-docservice ds-example ds-metrics

Docker

If you change the automatically generated key or manually disable JWT in /etc/onlyoffice/documentserver/local.json, JWT will be enabled again when the server restarts, and the key will be regenerated. To avoid this issue, please use environment variables in the docker run command. To disable JWT, use -e JWT_ENABLED=false.

Reference Documentation

OnlyOffice Upgrade to HTTPS

  1. Add HTTPS certificate configuration under OnlyOffice's NGINX configuration, default path: /etc/nginx/conf.d/ds.conf

Example:

include /etc/nginx/includes/http-common.conf;
server {
  listen 0.0.0.0:9002 ssl;
  listen [::]:9002 ssl;
  server_tokens off;

  # SSL configuration
  ssl_certificate /etc/nginx/***.crt;
  ssl_certificate_key /etc/nginx/***.key;

  # Add other SSL-related configurations, such as TLS version and cipher suite configurations

  include /etc/nginx/includes/ds-*.conf;
}
  1. Test and refresh NGINX configuration:
shell
nginx -t
nginx -s reload
  1. Modify the Informat background parameter configuration [System Information - Parameter Settings - File Preview Service - Office File Preview Address] to update to the latest domain name

Frontend shows "The file size exceeds the limit set for the server"

Reason: The file is too large. By default, OnlyOffice's file size limit is 100MB.

Solution:

bash
# Modify OnlyOffice configuration file
vi /etc/onlyoffice/documentserver/default.json

# Modify FileConverter.converter.maxDownloadBytes
# Modify the zip.uncompressed property for all sub-items in FileConverter.converter.inputLimits
# Adjust the preview file size limit to 2000MB as shown in the example:
"FileConverter": {
 "converter": {
   "maxDownloadBytes": 2097152000,
   "inputLimits": [
     {
        "type": "docx;dotx;docm;dotm",
        "zip": {
                "uncompressed": "2000MB",
                "template": "*.xml"
        }
     },
     {
        "type": "xlsx;xltx;xlsm;xltm",
        "zip": {
                "uncompressed": "2000MB",
                "template": "*.xml"
        }
     },
     {
        "type": "pptx;ppsx;potx;pptm;ppsm;potm",
        "zip": {
                "uncompressed": "2000MB",
                "template": "*.xml"
        }
     }
   ]
 }
}

# Modify NGINX configuration
vi /etc/nginx/includes/ds-common.conf

# Modify client_max_body_size to 2000m
client_max_body_size 2000m;

# Restart service
systemctl restart supervisord