The reliable way to run Nextcloud on a VPS is a Docker Compose project with one persistent Nextcloud volume, one persistent database volume, a supported database, and a reverse proxy that terminates HTTPS. Use the Apache image for the simplest deployment, run production background jobs with system cron, and back up the application state and database outside the VPS. A single, disposable container is suitable only for limited testing, not for a live file service.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
What the finished deployment looks like
Your public domain points to the VPS. A reverse proxy such as Nginx, Caddy, or Traefik accepts HTTPS on the host, renews the certificate, and forwards requests over the private Docker network to the Nextcloud container. Nextcloud stores its code, configuration, apps, themes, and user files in a persistent volume. A separate MariaDB, MySQL, or PostgreSQL container stores the database in its own persistent volume. Docker Compose starts and updates these components together.
As an Amazon Associate I earn from qualifying purchases.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallThis separation matters. Recreating a container must not delete users, files, configuration, or database records. Docker volumes are durable storage, not backups: copy them or export their contents to a different system and test that you can restore them.
Requirements and sizing
VPS and operating system
- Use a current 64-bit Linux distribution supported by your VPS provider.
- Give the VPS a stable public address and create a DNS record for a hostname such as
cloud.example.comthat points to it. - Allow inbound SSH and the reverse proxy’s HTTP and HTTPS ports. The exact firewall commands differ between distributions and providers, so apply the provider’s documented method rather than copying a command intended for another system.
- Install Docker Engine and the Docker Compose plugin from the distribution or Docker’s supported packages.
Memory and storage
Nextcloud’s current requirements state that it needs at least 128 MB of RAM per process and recommend at least 512 MB per process. Those figures describe a process, not a complete VPS budget: the operating system, database, reverse proxy, PHP workers, indexing, previews, and other apps also consume memory. Leave headroom for upgrades and bursts rather than sizing the machine to the minimum alone.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Storage depends on the files you will keep, database growth, previews, logs, and available backup copies. Put the Docker data directory on storage with enough free space for the live dataset and temporary upgrade work. Monitor disk usage; a full volume can stop uploads and prevent the database from writing.
Database choices
Supported choices include MariaDB, MySQL, PostgreSQL, and SQLite. SQLite is intended for testing and very small, minimal instances. For a normal VPS deployment, use MariaDB, MySQL, or PostgreSQL. Choose between them according to the database tools your team already knows, the backup and monitoring facilities available from your provider, and the operational documentation you can maintain. Do not run the database without a persistent volume.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Choose the Docker architecture
Apache image or FPM image
The official Nextcloud image offers an Apache variant and an FPM variant. Apache includes a web server in the application container and is the simpler choice when you are building a new stack. FPM is appropriate when an existing Nginx, Caddy, or another web server will serve static files and communicate with PHP-FPM. FPM gives more control over an established web-server design but requires more proxy and FastCGI configuration.
Compose or Nextcloud AIO
A hand-built Compose project exposes each component, volume, network, and upgrade decision, making it suitable when you want to operate the VPS yourself. Nextcloud AIO is the official automated option. It bundles additional services, including Office, a turnkey backup solution, and Imaginary. Choose AIO when those bundled components and its automation are more valuable than component-level control. Choose a custom Compose stack when you already have a proxy, monitoring, storage policy, or database process that you need to integrate precisely.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Prepare the VPS
- Update the operating system and reboot if the kernel or core libraries require it.
- Set the VPS hostname and confirm its clock is correct. Accurate time is important for certificates, logs, and scheduled jobs.
- Create the DNS record and wait until it resolves to the VPS address from an external network.
- Install Docker Engine and verify both commands work:
docker versionanddocker compose version. - Create a project directory with restricted permissions, for example
/opt/nextcloud, and keep your Compose file and environment file there. - Configure the firewall to expose SSH and the reverse proxy’s HTTP/HTTPS ports only. Do not expose the database port to the public internet.
Create a persistent Compose project
The following baseline uses the Apache image and MariaDB. It publishes the app only on the VPS loopback address, leaving public TLS and HTTP handling to the reverse proxy. Replace the environment-file values with strong, unique secrets and protect that file from other users.
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: unless-stopped
environment:
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- db_data:/var/lib/mysql
app:
image: nextcloud:apache
restart: unless-stopped
ports:
- 127.0.0.1:8080:80
depends_on:
- db
environment:
MYSQL_HOST: db
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- nextcloud_data:/var/www/html
volumes:
db_data:
nextcloud_data:
Save the file as compose.yml. Create a separate environment file containing MYSQL_PASSWORD and MYSQL_ROOT_PASSWORD, set permissions so only the deployment administrator can read it, and do not commit it to source control. The image also supports _FILE secret variables, which let you provide passwords through mounted secret files instead of putting values directly in the Compose environment section.
Recommended Free Tools
For production, pin image tags that you have tested rather than relying indefinitely on an unchanging latest tag. Record the chosen tags with your backup and upgrade notes. If you select PostgreSQL, use the PostgreSQL image and its documented environment variables and change the Nextcloud database settings accordingly; do not mix MariaDB variables with a PostgreSQL container.
Start the containers and initialize Nextcloud
- From the project directory, run
docker compose up -d. - Check that both services are running with
docker compose ps. - Inspect startup output with
docker compose logs --follow appand, separately,docker compose logs --follow db. Stop following with the usual terminal interrupt after checking for configuration or permission errors. - Configure the reverse proxy before exposing the hostname publicly, or temporarily use the loopback endpoint only for local verification.
- Open the domain in a browser. The Nextcloud setup wizard asks for an administrator account and database connection details. Enter the database host as the Compose service name,
db, notlocalhost; containers have their own network namespace. - Complete the wizard and confirm that you can sign in, create a folder, upload a test file, and download it again.
If you prefer unattended initialization, supply every database environment variable required by the image and verify the resulting configuration before allowing users to connect. Never treat the writable layer of a short-lived container as storage; only the mounted volumes survive container replacement.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Put HTTPS and a reverse proxy in front
The Docker project states that HTTPS encryption is mandatory when the server is reachable from the internet. Terminate TLS at Nginx, Caddy, Traefik, or another capable reverse proxy, obtain a certificate for the DNS name, and forward requests to the app’s private address. Keep the app port bound to loopback or the Docker network instead of publishing it to every interface.
Generic proxy requirements
- Forward the original
Hostheader. - Forward the client and protocol information through the appropriate
X-Forwarded-ForandX-Forwarded-Protoheaders. - Allow request bodies large enough for your files; an overly small proxy limit causes uploads to fail even when Nextcloud is configured correctly.
- Support long-running WebSocket or streaming connections if an installed Nextcloud app requires them.
- Redirect plain HTTP to HTTPS after certificate issuance, while retaining port 80 when your certificate automation needs an HTTP challenge.
Example Nginx arrangement
With the Compose mapping above, Nginx can proxy the hostname to http://127.0.0.1:8080. A minimal server block has the following shape; add your certificate directives and proxy-timeout policy using the method you already operate on the VPS.
server {
listen 80;
server_name cloud.example.com;
client_max_body_size 10G;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
The same responsibilities apply with Caddy or Traefik; their configuration syntax differs, but Nextcloud still needs correct forwarding and proxy trust. Do not copy an Nginx block into a Caddy or Traefik configuration.
Tell Nextcloud which proxy is trusted
When TLS terminates upstream, configure Nextcloud’s trusted_proxies with the actual proxy IP address or CIDR. Also set overwriteprotocol to https, and set overwrite host or the command-line URL only when your topology requires those values. Use the occ command from the app container, adapting the index and value to your network:
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
docker compose exec --user www-data app php occ config:system:set trusted_proxies 0 --value=${PROXY_IP_OR_CIDR}
docker compose exec --user www-data app php occ config:system:set overwriteprotocol --value=https
Replace the shell variable with the address or CIDR of the proxy that actually connects to Nextcloud. Trusting every source is unsafe: incorrect proxy trust can let an untrusted client spoof its address and can affect logging and access-control decisions. If the proxy and app share a Docker network, inspect that network and use the proxy’s real container or network address rather than guessing.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Enable production background jobs with cron
Nextcloud recommends system cron for production instances. The cron worker runs cron.php and performs cleanup and other recurring tasks registered by Nextcloud and its apps. Web-triggered background jobs are less predictable because they depend on visitors opening the site.
- Open the Nextcloud administration settings and select the background-job option for system cron.
- From the Compose project directory, test the worker manually with
docker compose exec --user www-data app php occ background:cron. - Schedule the equivalent
cron.phpinvocation from the VPS host or from a dedicated scheduler at a regular interval appropriate to your workload. Use the service name and path in your own Compose project. - Review the Nextcloud administration page and container logs after the first scheduled runs. A permissions error, wrong PHP path, or scheduler running as the wrong user will leave jobs pending.
Run the job as the web user used by the image, normally www-data. Do not execute maintenance tasks as root unless the image documentation specifically requires it; root-owned files can prevent the web process from updating them.
Back up every part of the instance
A usable Nextcloud backup includes the database and all application state: configuration, data, custom apps when used, and the theme. In the Compose layout, these items are normally inside the Nextcloud volume, while the database is in its own volume. Keep backup copies outside the live Docker volumes and, ideally, outside the VPS failure domain.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
- Announce a maintenance window and enable maintenance mode with
docker compose exec --user www-data app php occ maintenance:mode --on. - Export the database with the database engine’s native dump tool. Use a transaction-consistent dump for MariaDB, MySQL, or PostgreSQL and supply credentials through a protected mechanism rather than placing them in shell history.
- Copy or archive the Nextcloud configuration, data, custom-app directory, and theme directory from the persistent app volume. Include any extra mounted directories you added to the Compose file.
- Record the Compose file, image tags, environment-variable names, proxy configuration, and firewall policy needed to rebuild the VPS. Store secrets separately and securely.
- Verify archive checksums, move copies to independent storage, and periodically perform a restoration into an isolated Compose project.
- Disable maintenance mode with
docker compose exec --user www-data app php occ maintenance:mode --offand test login, file access, sharing, and background jobs.
Do not assume that a VPS snapshot, a Docker volume, or a database volume alone is a complete backup. A snapshot taken while files and database transactions are changing may be inconsistent; maintenance mode and a database dump give you a defined recovery point.
Upgrade without turning it into a rebuild
- Read the release and image notes for the version you intend to run and confirm that your database and installed apps support it.
- Put Nextcloud in maintenance mode and complete the backup procedure.
- Pull the tested image tag with
docker compose pull, then recreate the services withdocker compose up -d. - Follow the upgrade output with
docker compose logs --follow app. If the image requires an explicit database migration, run the documentedocc upgradecommand aswww-data. - Check the administration page, cron status, proxy access, uploads, and a representative custom app before ending maintenance mode.
Keep the previous image tag and a restorable database dump until the new release has passed your checks. Never delete the persistent volumes as part of an ordinary image upgrade.
Common failures and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| The installer cannot connect to the database | Wrong host, credentials, or startup timing | Use the Compose service name db, verify the environment values, inspect both service logs, and wait for the database to finish initialization. |
| Redirect loops or links use HTTP | Proxy headers or overwrite settings are incomplete | Forward the host and protocol, trust only the real proxy address, and set overwriteprotocol to https when TLS ends at the proxy. |
| Users see the proxy address instead of their real address | Missing or overly broad trusted-proxy configuration | Set trusted_proxies to the proxy’s actual IP or CIDR and confirm the proxy sends the client-address header. |
| Large uploads fail at a fixed size | The reverse proxy’s body limit is smaller than the file | Raise the proxy body-size limit, then check PHP and Nextcloud upload limits. |
| Background jobs remain overdue | Cron is not scheduled, uses the wrong user, or calls the wrong container | Run the occ background:cron test manually, inspect scheduler logs, and use the app service and www-data. |
| Files disappear after recreating a container | The app or database was not mounted on a persistent volume | Inspect docker compose config and docker volume ls; restore from backup if the data was only in the discarded container layer. |
| The database fills the disk | Unmanaged logs, binary logs, or insufficient storage planning | Check database and Docker disk usage, rotate logs according to your policy, and expand storage before writes fail. |
Security and maintenance checklist
- Use a long, unique administrator password and separate database credentials.
- Keep the operating system, Docker Engine, proxy, database, and Nextcloud image updated on a planned schedule.
- Expose only SSH and the proxy’s HTTP/HTTPS ports; never publish the database port publicly.
- Use HTTPS for every client connection and verify certificate renewal before the old certificate expires.
- Protect the Compose environment file and any secret files with restrictive permissions.
- Review installed apps and remove those you no longer maintain.
- Monitor CPU, memory, storage, database health, failed logins, and scheduled-job status.
- Test a complete restore, not merely the existence of backup archives.
When AIO is the better fit
Use AIO when you want an official, automated Docker deployment with bundled Office, Imaginary, and a turnkey backup solution, and you are willing to follow AIO’s supported topology. A custom Compose stack is the better fit when you need to keep an existing Nginx, Caddy, or Traefik setup, choose each service independently, integrate with your own monitoring, or control database and storage decisions yourself. Both approaches still require a supported VPS, persistent storage, HTTPS, careful proxy trust, cron or the supported background-job mechanism, and tested backups.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




