This guide walks you through installing and configuring OnlyOffice Document Server on your own VPS, so your team can collaborate on documents, spreadsheets, and presentations in real time without relying on third-party cloud services. You’ll end up with a private, self-hosted office suite that integrates with tools like Nextcloud or can be used standalone. Before starting, you’ll need a VPS with at least 4 GB of RAM (8 GB recommended), a domain name pointing to the server, and basic comfort with the command line.
What You’ll Need
- A VPS running Ubuntu 22.04 or 24.04 (or Debian 11/12) with root or sudo access.
- A domain name (e.g., office.example.com) with an A record pointing to your server’s IP.
- Ports 80 and 443 open in your firewall.
- At least 4 GB of RAM and 20 GB of free disk space.
- Docker and Docker Compose installed (we’ll cover this).
Step-by-Step
- Update your system and install dependencies. SSH into your VPS and run
sudo apt update && sudo apt upgrade -y. Then install basic tools:sudo apt install -y curl git nano. - Install Docker and Docker Compose. Use the official convenience script:
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh. Verify withdocker --versionanddocker compose version. If compose isn’t available, install it separately from the Docker docs. - Create a directory for OnlyOffice. Run
mkdir ~/onlyoffice && cd ~/onlyofficeto keep everything organized. - Create a Docker Compose file. Use
nano docker-compose.ymland paste the following minimal configuration:services: onlyoffice: image: onlyoffice/documentserver:latest container_name: onlyoffice ports: - "80:80" - "443:443" environment: - JWT_ENABLED=true - JWT_SECRET=your-super-secret-key volumes: - onlyoffice_data:/var/www/onlyoffice/Data - onlyoffice_logs:/var/log/onlyoffice - onlyoffice_cache:/var/lib/onlyoffice - onlyoffice_db:/var/lib/postgresql restart: unless-stopped volumes: onlyoffice_data: onlyoffice_logs: onlyoffice_cache: onlyoffice_db:Save with Ctrl+O, then Ctrl+X.
- Set a strong JWT secret. Replace
your-super-secret-keywith a long random string. You can generate one withopenssl rand -base64 32. - Start OnlyOffice. Run
sudo docker compose up -d. The first pull may take a few minutes. Check logs withsudo docker compose logs -funtil you see a message that the server is ready. - Configure a reverse proxy with HTTPS. For production, don’t expose OnlyOffice directly. Install Nginx:
sudo apt install -y nginx. Then create a site config:sudo nano /etc/nginx/sites-available/onlyofficewith a server block that proxies tohttp://localhost:80and includes the proper headers. Enable it with a symlink and restart Nginx. - Obtain an SSL certificate. Install Certbot:
sudo apt install -y certbot python3-certbot-nginx. Runsudo certbot --nginx -d office.example.comand follow the prompts. This automatically configures HTTPS. - Test the installation. Visit
https://office.example.comin your browser. You should see the OnlyOffice welcome page. To verify functionality, create a test document using the built-in editor. - Integrate with Nextcloud (optional but recommended). Install the OnlyOffice connector app in Nextcloud (via the app store). In Nextcloud admin settings, under OnlyOffice, enter your server URL and the JWT secret you set earlier. Now your team can open and edit documents directly from Nextcloud.
- Set up automatic updates. Add a cron job to pull new images and recreate the container weekly:
sudo crontab -eand add0 2 * * 0 cd ~/onlyoffice && docker compose pull && docker compose up -d.
Common Mistakes
- Insufficient RAM. OnlyOffice is memory-hungry. With less than 4 GB, it may crash or fail to start. Check with
free -hand consider adding swap. - Using HTTP for integration. Nextcloud and other clients require HTTPS. If you try to use a plain HTTP URL, the connection will be blocked.
- Forgetting the JWT secret. If you integrate with Nextcloud and don’t set the same secret, document editing will fail with a JWT error.
- Not opening ports. OnlyOffice needs ports 80 and 443 open. If you have a firewall (ufw), run
sudo ufw allow 80,443/tcp. - Using the default secret. Leaving the JWT secret as “your-super-secret-key� is a security risk. Always change it.
Tips
- For larger teams, increase VPS RAM to 8 GB or more. OnlyOffice uses about 2-4 GB under load.
- Use a separate volume for database backups. The
onlyoffice_dbvolume contains PostgreSQL data; back it up regularly. - If you plan to use OnlyOffice with Nextcloud, install the connector app on the same server to reduce latency.
- Keep your JWT secret in a password manager. You’ll need it for every integration.
- Consider setting up a firewall that only allows SSH, HTTP, and HTTPS.
- Use a subdomain like
doc.example.cominstead of the root domain to avoid conflicts with other services.
Troubleshooting
OnlyOffice won’t start. Check logs with sudo docker compose logs. Common causes: insufficient memory, port conflicts, or a bad volume mount. Ensure no other service uses port 80/443.
Document editor shows “Connection lost�. This often happens when the JWT secret doesn’t match between OnlyOffice and the client (e.g., Nextcloud). Double-check both settings.
Can’t access the web interface. Verify the container is running (docker ps) and that the firewall allows traffic. Test with curl -I http://localhost from the server.
SSL certificate fails to renew. Certbot auto-renewal requires that your domain resolves to the server and port 80 is reachable. Test renewal manually with sudo certbot renew --dry-run.
OnlyOffice is slow. Check CPU and memory usage with htop. If the server is constantly swapping, increase RAM or reduce concurrent users.
Editing in Nextcloud fails with “Bad request�. Ensure the OnlyOffice URL in Nextcloud settings has no trailing slash, and the JWT secret is exactly the same.
Frequently Asked Questions
Can I use OnlyOffice without Docker?
Yes, but Docker is the officially supported method and simplifies upgrades. Manual installation is more complex and error-prone.
How many users can I host on a 4 GB VPS?
For light usage, 10-20 concurrent editors is realistic. Each active editor consumes about 200-300 MB of RAM. For larger teams, go with 8 GB or more.
Does OnlyOffice support real-time collaboration?
Yes, it supports co-editing with multiple users on the same document, with changes synced in real time.
Can I integrate OnlyOffice with other platforms like ownCloud or Seafile?
OnlyOffice has official connectors for Nextcloud, ownCloud, and others. For unsupported platforms, you can use the API directly.
Is it possible to use a free SSL certificate?
Yes, Let’s Encrypt provides free certificates, and the Certbot step above does exactly that. Just make sure your domain is valid.
What happens if my VPS runs out of disk space?
OnlyOffice may fail to save documents. Monitor disk usage with df -h and clean up old Docker images with docker image prune.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Valheim Server Not Showing in Community List Fixes
- DisplayPort vs HDMI: Which Cable Should You Use?
- Soundbar vs 2.1 Speaker System: Which Is Better?
- Mouse Moving on Its Own? Causes & Fixes
- Slack Channels for Construction Projects: Setup Guide
- Surface Won’t Turn On: Quick Fixes1.8 h