📄 Setup OnlyOffice Document Server — Self-Hosted Office Suite
Deploy OnlyOffice Document Server on Ubuntu with Docker — the self-hosted office suite with real-time collaborative editing for Word, Excel, and PowerPoint files, and native integration with Nextcloud, Seafile, and Owncloud.
📦 Resources & Setup Scripts
Before starting, please make sure to grab the required scripts from our GitHub repository.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/refs/heads/main/tools/onlyoffice/onlyoffice-ubuntu.sh
chmod +x onlyoffice-ubuntu.sh
sudo bash onlyoffice-ubuntu.sh
Tutorial Steps
1 Download the Script
wget https://raw.githubusercontent.com/mhmdali94/Docker/refs/heads/main/tools/onlyoffice/onlyoffice-ubuntu.sh
2 Make it Executable
chmod +x onlyoffice-ubuntu.sh
3 Run the Installer
The script installs Docker, generates a random JWT_SECRET, and starts the OnlyOffice Document Server container (onlyoffice/documentserver) with the JWT secret configured as an environment variable and host port 8080 mapped to container port 80.
sudo bash onlyoffice-ubuntu.sh
4 Access the Document Server
Verify the server is running by opening the welcome page:
http://<your-server-ip>:8080/welcome
Ports Used
| Port | Purpose |
|---|---|
| 8080 | OnlyOffice Document Server (HTTP) |
| 443 | HTTPS (via reverse proxy) |
Overview
OnlyOffice Document Server is an open-source office suite that provides browser-based editing for Word (DOCX), Excel (XLSX), and PowerPoint (PPTX) documents. It uses the same file formats as Microsoft Office, making it the most compatible self-hosted alternative for organizations migrating from Office 365. OnlyOffice supports real-time collaborative editing with simultaneous multi-user access, change tracking, comments, integrated chat, form filling, and digital signatures. It is designed to integrate as a backend editing engine for file management platforms — Nextcloud, Seafile, Owncloud, and Alfresco all have official OnlyOffice plugins. The Docker Community Edition is free and covers most use cases; the Enterprise Edition adds load balancing and advanced management features.
Why Use It
Microsoft 365 and Google Workspace charge per user per month and require your documents to live on their servers. OnlyOffice keeps your document editing fully self-hosted, with the highest Microsoft Office format compatibility among open-source alternatives. When paired with Nextcloud, it creates a complete self-hosted Office 365 replacement — file storage, sharing, and real-time document editing, all on your own infrastructure.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
OnlyOffice listens on host port 8080 mapped to container port 80. For production, put it behind Nginx Proxy Manager with HTTPS and a valid SSL certificate — most integrations (Nextcloud, Seafile) require HTTPS for the OnlyOffice URL. Never expose port 8080 publicly without HTTPS and JWT authentication. Firewall: ufw allow from 192.168.1.0/24 to any port 8080.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Collabora Online (LibreOffice-based) is the primary alternative and is also available as a Nextcloud integration. LibreOffice Online requires more setup but is fully AGPL-licensed. For a simpler approach without document editing, Nextcloud's built-in text editor handles plain Markdown files. CryptPad provides encrypted collaborative editing without a separate document server.
When Not to Use It
OnlyOffice Document Server is resource-intensive — the container uses 1–2 GB RAM at idle. For very low-spec servers (1 GB RAM VPS), the container may OOM-kill during document rendering. If you only need Markdown or plain text collaboration, lighter alternatives (HedgeDoc, Outline) are more appropriate. The Community Edition imposes a simultaneous connection limit — for large teams with many concurrent document editors, consider the Enterprise Edition or Collabora Online.
Frequently Asked Questions
What is the JWT secret in OnlyOffice?
OnlyOffice uses JWT to authenticate API requests between the document server and connected apps (Nextcloud, Seafile). Both must share the same JWT_SECRET value. The install script generates a secure random secret automatically — note it down for Nextcloud integration.
How do I connect OnlyOffice to Nextcloud?
Install the ONLYOFFICE app from the Nextcloud App Store. In Nextcloud Administration → ONLYOFFICE, enter your Document Server URL (https://onlyoffice.yourdomain.com) and the JWT_SECRET from your Docker environment.
What file formats does OnlyOffice support?
OnlyOffice supports DOCX, XLSX, PPTX (Microsoft Office), ODT, ODS, ODP (OpenDocument), PDF, TXT, CSV, HTML, and more. It provides the highest compatibility with Microsoft Office formats among open-source editors.
What port does OnlyOffice use?
OnlyOffice listens on host port 8080 (mapped to container port 80). For production, use Nginx Proxy Manager with HTTPS — Nextcloud and most integrations require an HTTPS URL for the document server.
Can multiple users edit a document simultaneously?
Yes. OnlyOffice Document Server supports real-time collaborative editing with simultaneous multi-user access, live cursor positions, change tracking, and integrated document chat.
