Nextcloud on Ubuntu 24.04 on Azure User Guide
Overview
Nextcloud is the popular open-source content-collaboration platform: file sync and share, calendar, contacts, collaborative documents and a rich app ecosystem, all self-hosted inside your own Azure VNet for data residency and compliance. The cloudimg image installs Nextcloud 30.0.14 (AGPL-3.0) served by nginx and PHP 8.3-FPM, backed by a local PostgreSQL 16 database and Redis for file locking and caching. The Nextcloud data directory and the PostgreSQL datadir both live on a dedicated 60 GiB Azure data disk. A unique admin password and database password are generated on the first boot of every VM. Backed by 24/7 cloudimg support.
What is included:
- Nextcloud 30.0.14 (web root
/var/www/nextcloud) served by nginx on:80 - PHP 8.3-FPM with every extension Nextcloud requires (gd, curl, mbstring, intl, bcmath, gmp, imagick, apcu, pdo_pgsql, zip, exif, bz2)
- A local PostgreSQL 16 database and Redis for distributed + file-locking cache
- A dedicated Azure data disk at
/var/lib/nextcloudholding both the Nextclouddata/directory and the PostgreSQL datadir - A per-VM admin account and database password generated on first boot and recorded in a root-only file
nginx.service,php8.3-fpm.service,postgresql.service,redis-server.serviceas enabled systemd units, plus a 5-minute background-jobs timer- 24/7 cloudimg support
Prerequisites
An active Azure subscription, an SSH key pair, and a VNet + subnet in the target region. Standard_B4ms (4 vCPU / 16 GiB RAM) is a good starting point. NSG inbound: allow 22/tcp from your management network and 80/tcp for the web interface. Nextcloud serves plain HTTP on port 80; for production, terminate TLS in front of it with your own domain and a certificate (for example with certbot).
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Nextcloud by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22) and HTTP (80). Review the dedicated 60 GiB data disk on the Disks tab, then Review + create -> Create.
Step 2 - Deploy from the Azure CLI
az vm create \
--resource-group <your-rg> \
--name nextcloud \
--image <marketplace-image-urn> \
--size Standard_B4ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name nextcloud --port 80 --priority 1010
Step 3 - Connect to your VM
ssh azureuser@<vm-public-ip>
Step 4 - Confirm the services are running
The web tier, PHP runtime, database and cache all run as systemd units:
systemctl is-active nginx.service php8.3-fpm.service postgresql.service redis-server.service
Each line reports active. On first boot the VM rotates the Nextcloud admin password and the database password to values unique to your instance.
Step 5 - Confirm the health endpoint
nginx serves an unauthenticated health probe, separate from the Nextcloud web root (which redirects to the sign-in page):
curl -s http://localhost/health
It returns ok.
Step 6 - Confirm Nextcloud is installed and healthy
Nextcloud's status.php endpoint reports the install state and version without requiring a login:
curl -s http://localhost/status.php
The JSON response contains "installed":true and "version":"30.0.14...".
Step 7 - Retrieve your admin password
The admin password and database password are generated uniquely on the first boot of your VM and written to a root-only file:
sudo cat /root/nextcloud-credentials.txt
This file contains NEXTCLOUD_ADMIN_USER (admin), NEXTCLOUD_ADMIN_PASSWORD, and the database name, user and password. Store the admin password somewhere safe.
Step 8 - Sign in to the web interface
Browse to http://<vm-public-ip>/ and sign in as admin with the password from Step 7. On first boot the image adds the VM's detected public and private IPv4 addresses to Nextcloud's trusted-domains, so you can reach it immediately on the VM's public IP. If you front the instance with your own DNS name and see an "access through untrusted domain" page, whitelist it once with:
sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 3 --value your.domain.com
(This host-header allowlist is a deliberate security control - the image does not use a wildcard.)

After signing in you land in the Files app, where you upload, organise and share files and folders. The left rail gives quick access to Recent, Favorites, Shares and Tags.

The Administration settings give you a system overview, security and setup warnings, background-jobs mode, logging and more.

The Apps area is where you enable, disable and update Nextcloud apps - calendar, contacts, collaborative editing, and hundreds more from the app store.

Step 9 - Confirm the version from the command line
The occ command-line tool manages Nextcloud from the shell. Confirm the running version:
sudo -u www-data php /var/www/nextcloud/occ status
It prints installed: true and versionstring: 30.0.14.
Step 10 - Verify authentication over the API
Nextcloud's OCS user endpoint rejects unauthenticated requests and accepts your per-VM admin password. An unauthenticated request returns HTTP 401:
curl -s -o /dev/null -w '%{http_code}\n' -H 'OCS-APIRequest: true' http://localhost/ocs/v2.php/cloud/user
To prove end-to-end authentication, read your admin password from /root/nextcloud-credentials.txt (Step 7) and run, from a shell, curl -u admin:<password> -H 'OCS-APIRequest: true' http://<vm-public-ip>/ocs/v2.php/cloud/user — it returns HTTP 200 with your user record as XML. A wrong password returns 401.
Step 11 - Confirm where your data and database live
Both the Nextcloud data directory and the PostgreSQL datadir sit on the dedicated Azure data disk, so you can grow or snapshot them independently of the OS disk:
df -h /var/lib/nextcloud | tail -1
The mount /var/lib/nextcloud holds data/ (user files) and pgsql/main (the PostgreSQL cluster).
Step 12 - Maintenance
- Admin CLI: run any management command with
sudo -u www-data php /var/www/nextcloud/occ <command>(for exampleocc user:listorocc app:list). - Background jobs: a systemd timer runs
cron.phpevery 5 minutes (Nextcloud's recommended mode) - no action needed. - TLS: put a reverse proxy or certbot in front of port 80 with your own domain before exposing the instance to the internet.
- Backups: back up
/var/lib/nextcloud/data, the PostgreSQL database, and/var/www/nextcloud/config/config.php. - Updates: OS security updates are applied automatically by unattended-upgrades; upgrade Nextcloud itself with its built-in updater or
occ.
Support
This image is maintained by cloudimg with 24/7 support. Contact support@cloudimg.co.uk for assistance.