Self-host Nextcloud

Self-hosted file sync and sharing server with calendars, contacts and other collaboration apps, run from a web interface and sync clients. Run your own Nextcloud on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.

Updated November 23, 2026

Running your own Nextcloud usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make Nextcloud behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.

Just ask your agent

Open a Plus workspace (Nextcloud runs in Docker, which Plus and Pro include), tap Launch to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:

Set up Nextcloud on this workspace and give me the link. Follow https://envhaven.com/self-host/nextcloud.md

Then open the link it sends and create your Nextcloud account straight away, before anyone else finds the address. That is the whole request: the address in it is this page’s Markdown copy, and the agent follows the instructions for it further down, with every setting Nextcloud’s docs require.

Or keep it private with Tailscale

The preview URL puts Nextcloud on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives Nextcloud an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace’s Vars pane as TS_AUTHKEY, and ask the agent:

Set up Nextcloud on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/nextcloud.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
  • A Tailscale container runs beside Nextcloud, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
  • Anything other services have to reach, such as a webhook, still needs a public address. Keep self-hosted apps private with Tailscale covers both, and what Tailscale’s free plan includes.
At a glance
What it isFiles, photos and documents
LicenseAGPL-3.0-or-later
Runs asDocker (ghcr.io/nextcloud-releases/all-in-one)
Memoryadmin manual: minimum 128 MB RAM per process, 512 MB per process recommended (no whole-server figure); AIO: defaults to a max of 512 MB RAM per PHP process (docs)
Plan that fitsPlus or larger
Web port11000
Documentationdocs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html

What your agent takes care of

  • Installing it. Nextcloud runs from the official image, ghcr.io/nextcloud-releases/all-in-one, with its data in folders under ~/apps/nextcloud.
  • Putting it on an HTTPS address. The workspace’s preview URL serves it, and your own domain can too.
  • Locking it down first. What Nextcloud’s docs say to set before it faces the internet, below.
  • Telling you what to back up: AIO: the nextcloud_aio_* Docker volumes (datadir, database) managed by AIO, with a built-in Borg backup, community image: /var/www/html (code, config, data, apps) plus the database and manual install: config, data and theme folders plus the database (docs).

The settings it needs behind a proxy

  • APACHE_PORT: Environment variable on the AIO mastercontainer: the port the Apache container listens on for a reverse proxy or tunnel (11000 in the docs’ examples). (docs)
  • APACHE_IP_BINDING: Binds the Apache container to an address, 127.0.0.1 in the example, when the proxy or tunnel runs on the same host. (docs)
  • SKIP_DOMAIN_VALIDATION: Turns off AIO’s domain validation, which the docs say does not work behind a Cloudflare Tunnel. (docs)
  • upgrade=websocket: The docs’ Apache reverse proxy sample forwards websocket upgrades to the Apache container; a proxy has to pass them through. (docs)
  • NEXTCLOUD_TRUSTED_DOMAINS: Optional space-separated list of domains added to trusted_domains at install time. (docs)
  • TRUSTED_PROXIES: Space-separated list of trusted proxies; CIDR notation works for IPv4. Used together with APACHE_DISABLE_REWRITE_IP so Nextcloud reads host, protocol and client IP from the proxy’s forwarded headers. (docs)
  • APACHE_DISABLE_REWRITE_IP: Set to 1 to stop the Apache image replacing the client address with the X-Real-IP header of proxies in private ranges. (docs)
  • OVERWRITEHOST: Hostname of the proxy, optionally with a port. (docs)
  • OVERWRITEPROTOCOL: Protocol of the proxy, http or https. (docs)
  • OVERWRITEWEBROOT: Absolute path of the proxy, for a Nextcloud served under a sub-path. (docs)
  • OVERWRITECLIURL: CLI URL of the proxy, for example https://mydnsname.example.com. (docs)
  • trusted_domains: config.php list of domains users can log in on; the Nextcloud host header check depends on it. (docs)
  • trusted_proxies: config.php list of proxy IP addresses or CIDR ranges that Nextcloud trusts as proxies, so it can read the real client information. (docs)
  • forwarded_for_headers: config.php: which header carries the client IP (X-Forwarded-For by default); an incorrect value may let clients spoof their IP address. (docs)
  • overwritehost: config.php: hostname of the proxy, optionally with a port. (docs)
  • overwriteprotocol: config.php: protocol of the proxy, http or https; needed when the proxy handles https and Nextcloud would otherwise generate http URLs. (docs)
  • overwritewebroot: config.php: absolute web path of the proxy to the Nextcloud folder. (docs)
  • overwrite.cli.url: config.php: base URL for URLs generated by command line tools, background jobs and notifications. (docs)

Before it faces the internet

  • The web installation wizard appears on first run; specifying a complete database and admin credential set at initial deployment skips it. (docs)
  • Open the AIO interface on port 8080 by IP address, not by domain, because HSTS can block later access. (docs)
  • Keep trusted_domains set; the docs say it performs necessary security checks. (docs)
  • Set forwarded_for_headers correctly: the docs warn that an incorrect value may let clients spoof their IP address even through a trusted proxy. (docs)

Things to ask next

Everything after the install is one more sentence to the agent. Some that come up:

  • “Import the files in ~/artifacts, keeping their folders.”
  • “Check how much disk it uses, and warn me when the workspace passes 80 percent.”
  • “Move Nextcloud to app.example.com.” Add the domain on the dashboard’s Domains page with a CNAME to domains.envhaven.app, and the agent changes Nextcloud’s address settings to match.
  • “Update Nextcloud to the latest release.” It pulls the new image and recreates the container, data kept.

Instructions for the agent

The agent reads these from the page’s Markdown copy. They also work pasted on their own, if you would rather give them in your own words.

Set up Nextcloud on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, ghcr.io/nextcloud-releases/all-in-one, starting from the docs' compose file: https://github.com/nextcloud/all-in-one/blob/main/compose.yaml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- The docs' setup includes: PostgreSQL (started and managed by AIO); Redis (started and managed by AIO); Apache (web server container) and Nextcloud containers (started and managed by AIO).
- Keep the compose file in ~/apps/nextcloud and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to Nextcloud's port 11000.
- The preview URL terminates HTTPS in front of Nextcloud: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/nextcloud.md for the preview URL, as Nextcloud's docs describe for running behind a proxy; skip any that apply only when Nextcloud serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/nextcloud.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set Nextcloud up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.

What to know

  • In Docker, Nextcloud’s containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
  • The docs say Cloudflare only supports uploads up to 100 MB on the free plan. (docs)
  • Larger uploads fail with 413 unless chunking is used. (docs)
  • Cloudflare allows a fixed 100 s request timeout, and the docs say server-side processing such as assembling chunks that takes longer will not work. (docs)
  • The server’s chunk size for chunked uploads defaults to 100 MiB, and the docs say Cloudflare may limit to that size. (docs)
  • The documented way to change the chunk size is an occ command that takes a value in bytes; 0 turns chunking off. (docs)
  • The desktop client can send smaller chunks through its maxChunkSize setting, which the docs mention for use behind Cloudflare. (docs)
  • Uploads without chunking (for example WebDAV clients without chunking support) are limited by default; the web interface and the mobile and desktop clients use chunking. (docs)
  • The built-in Talk TURN server needs its own port and does not work behind Cloudflare Tunnel. (docs)
  • Talk needs port 3478 over TCP and UDP open for its TURN container. (docs)
  • The bundled Collabora (Nextcloud Office) does not work out of the box behind Cloudflare. (docs)
  • Domain validation can fail behind Cloudflare because Cloudflare may block the attempt. (docs)
  • Cloudflare’s Rocket Loader has to be disabled or the login prompt does not appear. (docs)
  • Cloudflare minimizing and deferring JavaScript can break the login button and user creation. (docs)
  • The AIO docs recommend Tailscale over Cloudflare Tunnel or Proxy where possible. (docs)
  • AIO needs the Docker socket mounted into its mastercontainer to start and manage the other containers. (docs)
  • Some VPS types lack kernel features AIO needs; KVM (non-virtualized) VPS are recommended. (docs)
  • For uploads in the manual or community setups, the admin manual states a default maximum upload size of 512 MB that depends on PHP settings. (docs)
  • Nextcloud expects its own host rather than a path under one, so it takes the workspace’s preview URL or a domain of its own.
  • A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.

Without a workspace

The manual route, on a server you run:

  1. Rent a Linux VPS, secure SSH, and create a user for the app.
  2. Install Docker and write a compose file from the official image.
  3. Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
  4. Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
  5. Keep the firewall closed except for the proxy, and schedule backups and updates.

Nextcloud’s own documentation covers each step for its install methods.

Sources

Facts about Nextcloud come from its own documentation, checked on 2026-11-23: