Nextcloud Hub 26 Summer:
Autonomy for Teams, Office on desktop, a fresh take on Photos
Explore what’s new in the release blog!
Deploying an air-gapped cloud keeps your collaboration off the public internet, so files, chats, and documents never leave your infrastructure and are protected from outside attacks.
Because Nextcloud is self-hosted software rather than a service, you decide when, where, and how it runs, and Nextcloud Files, Talk, Office, Groupware, and Flow all keep working without an outside connection. Even Nextcloud Assistant can be run air-gapped, as long as you use a locally hosted AI model.
This guide walks you through planning, installing, configuring, and maintaining Nextcloud in an air-gapped environment.
Step 1: Choose your air-gap model
“Air-gapped” can mean different levels of isolation, and Nextcloud works with all of them:
- Limiting some internet traffic
- Routing all traffic through a VPN
- Running purely on premises with no internet access
- Running on premises with no internet access, but allowing some form of VPN
First, decide how clients will reach the system. Three network layouts are common:
- LAN only: All Nextcloud components are exposed only in the local network, typically through a load balancer, with storage, Redis, and the database behind it.
- LAN plus mesh VPN: All client devices and all exposed servers join the same VPN, as with WireGuard or Tailscale, and everyone reaches the systems over it.
- LAN plus traditional VPN: The systems are reachable only on the local network, and a VPN host acts as a bridge that routes remote clients’ traffic through to Nextcloud.
Nextcloud doesn’t dictate how you manage your network, so pick the model that fits your security requirements.
Step 2: Plan your architecture
For an individual or an organization with fewer than around 500 users, a single server running all components is usually enough. At larger scale, you need to run Nextcloud on several web servers rather than one. Putting a load balancer in front of them spreads incoming user requests across the servers, so none of them gets overloaded and Nextcloud stays available if one fails.
Break the rest of the system down into its components so you can deploy and scale each one separately:
- Database: MySQL, MariaDB, or PostgreSQL, which stores most of Nextcloud’s information. Check the Nextcloud system requirements for currently supported versions.
- Redis: Provides caching and transactional file locking shared across all web servers, which improves performance.
- Storage: Shared storage that is identical for all web servers.
- Identity services: LDAP, Active Directory, SAML, or OIDC, attached and shared across the web servers.
- Nextcloud Talk high-performance backend: A separate signaling server and media gateway that lets calls with more participants scale. Without it, every participant sends their audio and video to every other participant.
- Nextcloud Office document server: Nextcloud Office runs as its own server, separate from the Nextcloud web servers.
The Nextcloud software doesn’t have to live on the web servers themselves. Mounting it from an NFS share lets you swap web servers in and out and keeps Nextcloud upgrades independent of operating system upgrades.
If your users work from several locations, latency depends mostly on your infrastructure and your network bandwidth, not on Nextcloud. Disk performance often matters more than network latency, so prefer SSDs over single hard drives. Even a home instance on a 16 Mbit/s down and 3 Mbit/s up connection remains usable from the other side of the world, so solid infrastructure with decent bandwidth comfortably supports users in different regions.
Step 3: Open the required ports and plan certificates
Clients need these ports to reach your deployment:
- Nextcloud (Files and web interface): ports 80 and 443
If you run Nextcloud Talk or Nextcloud Office, these ports need to be reached as well:
- Nextcloud Talk: port 3478 (a TURN server can route port 443 traffic to 3478)
- Nextcloud Office: port 443, usually through an HTTPS reverse proxy that also supports WebSocket connections
Nextcloud Office and Nextcloud Talk need direct access. Their backends run in parallel to Nextcloud rather than behind it, so every client device, whether a laptop, tablet, or phone, must be able to connect straight to the document server and the Talk backend, not just to the Nextcloud web servers. Nextcloud and the Nextcloud Office server must also be able to reach each other, so documents can be opened in the editor and changes saved back. Whether these backends sit behind your load balancer is up to you. The database and storage, by contrast, can stay fully behind Nextcloud.
If your firewall can’t allow port 3478 to the Talk backend, add a TURN server. It relays call audio and video when participants can’t connect to each other directly, for example behind strict firewalls or NAT. For deployments beyond roughly 100 users, run the Talk backend on its own server.
Finally, plan your SSL certificates. Avoid self-signed certificates, even in a fully air-gapped deployment, because they force users to accept them manually. Use valid certificates and schedule their renewal: expiry is easy to overlook in air-gapped and on-premises environments, and an expired certificate can suddenly lock users out.
Step 4: Install Nextcloud
There are two ways to install Nextcloud in an air-gapped environment.
Option A: Install first, then isolate (recommended)
Deploy Nextcloud in an environment that still has internet access, so it can download its package dependencies. Once Nextcloud is installed and configured, restrict the network.
With virtual machines, install everything before any user data or accounts exist, then shut the VMs down, copy their images (for example, QCOW2 or VMDK files) into your production environment, and start them up there. If the machines already sit where they’ll run in production, you may not need to move anything at all: simply tighten the network rules after setup.
Option B: Isolate first, then install
If the environment must be completely isolated from the start, you can set up a local package mirror. Nextcloud’s PHP dependencies come from your operating system’s package repositories, so mirror those for your distribution. For example, Ubuntu offers robust tooling for running your own mirror. Then download the Nextcloud release archive on a connected machine, transfer it, and deploy it directly in the isolated environment.
The Nextcloud AIO (All-in-One) Docker image isn’t designed for air-gapped installations, so use a package-based installation instead.
Step 5: Configure Nextcloud for offline operation
Adjust a few settings in config.php, which lives in the config folder of your Nextcloud installation, for example /var/www/nextcloud/config/config.php.
Setting has_internet_connection to “false” stops Nextcloud from trying to reach external services such as the app store, which would otherwise wait for connections that time out. Disabling updatechecker stops update checks.
Nextcloud Enterprise customers should also set has_valid_subscription to “true” in config.php, and they can apply their subscription key without internet access by using occ, Nextcloud’s command-line tool. Run it from the Nextcloud installation folder as the web server user, for example sudo -E -u www-data php occ on Debian or Ubuntu. To set the key, run occ config:app:set support potential_subscription_key --value <your-key>, or enter it in the “Support” section of the administration settings.
Step 6: Install apps without the Nextcloud App Store
Additional apps and integrations with other systems are installed via the Nextcloud App Store, which an air-gapped instance cannot reach.
Here’s what you’ll need to do instead:
- On a connected machine, open the app’s page on apps.nextcloud.com and click “Show Versions”.
- Download the version that matches your Nextcloud release as a .zip or .tar file.
- Extract the app into the apps directory on your Nextcloud host.
- Enable it on the Apps page or with
occ app:enable <app-id>.
If you keep a connected copy of your server, such as a cloned VM, you can also update apps there and then copy their folders into the apps, 3rdparty, or custom_apps directory of your air-gapped instance.
Step 7: Harden your deployment
Most hardening happens within Nextcloud itself. The built-in check in the “Overview” section of the administration settings reviews your instance and recommends ways to improve its security. Enterprise customers will find further guidance on the Nextcloud Portal and, depending on their plan, can also book an installation review by one of Nextcloud’s Sales Engineers to make sure best practices are followed.
Step 8: Keep your deployment up to date
Pick an update strategy that fits your isolation model:
- Clone the VMs without any user data, update the clones in a connected environment (Nextcloud as well as the operating system, web server, database, and PHP packages), and bring them back into the internal network.
- Allow limited internet access only for the duration of an update.
- Upload the new release files manually and update offline.
Whichever you choose, back up your database regularly, and always before you change or update the database servers, with mysqldump for MySQL or MariaDB and pg_dump for PostgreSQL.
When you replace the Nextcloud files during an update, always keep the config and data directories. Because apps are harder to download again in an air-gapped environment, also keep the apps, 3rdparty, and custom_apps directories where applicable. If you set a separate data directory or a remote mount during initial setup, make sure it isn’t overwritten.
Always upgrade one major version at a time. For example, go from Nextcloud 34 to 35, never straight from 34 to 36. The admin interface usually shows the available upgrade path, but on an air-gapped instance it may not be visible, so check it yourself. If Nextcloud can’t find some files after the upgrade, which is rare, run occ files:scan to rescan them.
For step-by-step upgrade instructions, see the manual upgrade guide in the Nextcloud administration manual. Nextcloud Enterprise customers will also find upgrade guides, including one on upgrading offline (air-gapped) installations, and recommended occ commands on the Nextcloud Portal.
See it in action
Curious what an air-gapped Nextcloud looks like in practice? In our on-demand webinar, we cut a Nextcloud server off from the internet completely: a ping to Google goes nowhere, yet browsing files, opening spreadsheets, and creating new documents work just as they always do. The session also includes a Q&A with practical answers on updates, installing apps offline, and running Nextcloud Talk behind a firewall.