Applications Azure

Nextcloud 35 on Ubuntu 26.04 on Azure User Guide

| Product: Nextcloud 35 on Ubuntu 26.04 LTS on Azure

Overview

Nextcloud is an open source, self-hosted content collaboration platform: sync files across desktops and phones, share them by link with people inside and outside your organisation, and add calendars, contacts, office editing and more from its app store, with your data kept on your own server. The cloudimg image delivers Nextcloud 35 fully installed on Ubuntu 26.04 LTS, served by nginx over HTTPS with PHP 8.5 FPM, backed by PostgreSQL 18, with Valkey for caching and file locking. Every VM creates its own Nextcloud instance on its first boot, so you sign in to a ready server with nothing to install. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.

Nextcloud is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0), and the complete, unmodified upstream release is shipped on the image under /var/www/nextcloud. cloudimg is not affiliated with, endorsed by, or sponsored by Nextcloud GmbH; "Nextcloud" is a registered trademark of Nextcloud GmbH. This image repackages the upstream open source release with cloudimg's provisioning and support.

What is included:

  • Nextcloud 35.0.3 from the official release (checksum verified), served from /var/www/nextcloud
  • nginx 1.28 (HTTPS on :443, with :80 redirected to HTTPS and a plain /healthz liveness endpoint), PHP 8.5 FPM with OPcache and APCu, PostgreSQL 18 and Valkey 9, all from the Ubuntu 26.04 archive; PostgreSQL and Valkey listen on the VM itself only
  • A separate 60 GiB managed data disk at /var/lib/nextcloud holding every file and the PostgreSQL database
  • A per-VM Nextcloud instance (its own instance id, password salt and server secret), administrator password, database password and self-signed TLS certificate, all made on first boot; the sign-in details go to the root-only file /root/nextcloud-credentials.txt. No default or shared login ships in the image
  • Background jobs run every five minutes by the nextcloud-cron.timer systemd timer, and uploads of up to 2 GB per request
  • nginx.service, php8.5-fpm.service, postgresql@18-main.service and valkey-server.service as systemd units, enabled and active
  • Ubuntu 26.04 LTS with unattended security upgrades on

Nextcloud sign-in

Prerequisites

An active Azure subscription, an SSH key pair, and a VNet plus subnet in the target region. Standard_B2ms (2 vCPU / 8 GiB RAM) is the recommended size; scale up for more users or heavier sync traffic. NSG inbound: allow 22/tcp from your management network and 443/tcp (HTTPS) plus 80/tcp (which redirects to HTTPS) from your users.

Step 1 — Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Nextcloud 35 on Ubuntu 26.04 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), HTTP (80) and HTTPS (443). The image brings its 60 GiB data disk with it, so there is nothing to add on Disks. Then Review + create and Create.

Step 2 — Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:nextcloud-ubuntu-26-04:default:latest

az vm create \
  --resource-group <your-rg> \
  --name nextcloud \
  --image cloudimg1647283583153:nextcloud-ubuntu-26-04:default:latest \
  --size Standard_B2ms \
  --admin-username azureuser \
  --generate-ssh-keys \
  --public-ip-sku Standard

Open HTTPS (and HTTP, which redirects) to reach the web interface:

az vm open-port --resource-group <your-rg> --name nextcloud --port 443 --priority 900
az vm open-port --resource-group <your-rg> --name nextcloud --port 80  --priority 910

Step 3 — Connect to your VM

ssh azureuser@<vm-public-ip>

To look the address up from the CLI:

az vm show --resource-group <your-rg> --name nextcloud --show-details --query publicIps -o tsv

Nextcloud is created on the VM's first boot, which takes a minute or two after the VM starts. Until it finishes, the web address answers a short "finishing its first boot" page; refresh after a minute.

Step 4 — Confirm the services are running

The four services that back Nextcloud and the background-jobs timer should all report active. Port 80 answers a lightweight /healthz check and redirects everything else to HTTPS; PostgreSQL (5432) and Valkey (6379) listen on the VM itself only:

systemctl is-active nginx php8.5-fpm postgresql@18-main valkey-server nextcloud-cron.timer
sudo ss -tlnp | grep -E ":(80|443|5432|6379) " | awk "{print \$4}" | sort -u
curl -s http://127.0.0.1/healthz; echo
curl -sI http://127.0.0.1/ | grep -iE "^(HTTP|location)"
curl -ks https://127.0.0.1/status.php | jq -c "{installed,maintenance,needsDbUpgrade,versionstring}"

Expected: five lines of active; nginx on 0.0.0.0:80 and 0.0.0.0:443 (and [::]), PostgreSQL on 127.0.0.1:5432 and Valkey on 127.0.0.1:6379 and [::1]:6379; ok; HTTP/1.1 301 Moved Permanently to https://; and {"installed":true,"maintenance":false,"needsDbUpgrade":false,"versionstring":"35.0.3"}.

Services, listeners, health and HTTPS

Step 5 — Retrieve your admin password

On the first boot of every VM, a one-shot service (nextcloud-firstboot.service) installs a Nextcloud instance that is unique to that VM: its own instance id, password salt and server secret, its own database password and its own administrator password. It also sets the VM's public address as Nextcloud's address and trusted domain, and makes a self-signed TLS certificate for it. No shared or default credentials ship in the image.

sudo ls -l /root/nextcloud-credentials.txt
sudo cat /root/nextcloud-credentials.txt

The file (mode 0600, root only) holds the sign-in URL, the administrator user (admin) and its password (NEXTCLOUD_ADMIN_PASSWORD), and the database name, user and password. The picture below shows it with the passwords masked:

The per-VM credentials file, masked

You can prove the sign-in from the VM's own shell. This reads the password from the file and asks Nextcloud's API who you are, then shows a wrong password is refused:

PW=$(sudo grep '^NEXTCLOUD_ADMIN_PASSWORD=' /root/nextcloud-credentials.txt | cut -d= -f2-)
curl -ks -u "admin:$PW" -H "OCS-APIRequest: true" "https://127.0.0.1/ocs/v2.php/cloud/user?format=json" | jq -r '.ocs.data.id'
curl -ks -o /dev/null -w 'wrong password -> %{http_code}\n' -u "admin:wrong-99" -H "OCS-APIRequest: true" "https://127.0.0.1/ocs/v2.php/cloud/user?format=json"

Expected: admin, then wrong password -> 401.

Step 6 — Sign in

Browse to https://<vm-public-ip>/ and sign in as admin with the password from the credentials file. Because the image ships a per-VM self-signed certificate, your browser shows a one-time certificate warning on first visit; accept it, or put the VM on your own domain with a trusted certificate (see Serving Nextcloud on your own domain below).

After signing in you land in Files, Nextcloud's file browser, with the default welcome files. Upload with the + New button or by dragging files into the window.

Files, after sign-in

Change the admin password from your avatar > Personal settings > Security, and add the people who will use the server from your avatar > Accounts.

Step 7 — Sync files over WebDAV

The Nextcloud desktop and mobile apps, and any WebDAV program, sync through https://<vm-public-ip>/remote.php/dav/files/<user>/. This uploads a file as admin, reads it back and removes it, the same way a sync app does:

PW=$(sudo grep '^NEXTCLOUD_ADMIN_PASSWORD=' /root/nextcloud-credentials.txt | cut -d= -f2-)
echo "hello from cloudimg" > /tmp/hello.txt
curl -ks -o /dev/null -w 'upload -> %{http_code}\n' -u "admin:$PW" -T /tmp/hello.txt https://127.0.0.1/remote.php/dav/files/admin/hello.txt
curl -ks -u "admin:$PW" https://127.0.0.1/remote.php/dav/files/admin/hello.txt
curl -ks -o /dev/null -w 'delete -> %{http_code}\n' -u "admin:$PW" -X DELETE https://127.0.0.1/remote.php/dav/files/admin/hello.txt
rm -f /tmp/hello.txt

Expected: upload -> 201, hello from cloudimg, then delete -> 204.

To sync a folder from your computer, install the Nextcloud desktop app, give it the server address https://<vm-public-ip>/ and sign in. Until the VM has a certificate your computer trusts, the app asks you to accept the self-signed one.

Step 8 — Administration and apps

As admin, open your avatar > Administration settings. Overview runs Nextcloud's own setup and security checks against this server and shows the version. On a new VM it shows no warnings, only notes on things that are yours to set up, such as an email server and enforced two-factor authentication.

Administration > Overview

Your avatar > Apps lists the apps that are enabled and lets you add more from the Nextcloud app store, such as Calendar, Contacts, Deck or Talk.

Apps > Active apps

Step 9 — Confirm the version and the stack

sudo -u www-data php /var/www/nextcloud/occ status
php -v | head -1
psql --version; valkey-server --version | cut -d" " -f1-3; nginx -v
lsb_release -ds

Expected: versionstring: 35.0.3 with installed: true and maintenance: false, PHP 8.5.4, PostgreSQL 18.6, Valkey server v=9.0.6, nginx/1.28.3 and Ubuntu 26.04.1 LTS.

Version and stack

Step 10 — Your data disk and the first boot

Every file Nextcloud stores and the PostgreSQL database live on the separate data disk mounted at /var/lib/nextcloud, so you can grow it from the Azure portal without touching the OS disk:

df -h /var/lib/nextcloud
sudo -u www-data php /var/www/nextcloud/occ config:system:get datadirectory
sudo -u postgres psql -tAc "SHOW data_directory"
sudo journalctl -u nextcloud-firstboot -o cat | grep "nextcloud-firstboot:" | cut -c28- | head -11

Expected: a 59G filesystem on /var/lib/nextcloud, Nextcloud's data at /var/lib/nextcloud/data, PostgreSQL's at /var/lib/nextcloud/pgsql/main, and the first-boot steps: the instance installed with its own secrets, the install-time database password rotated, Nextcloud's optional indices and repair steps run, the per-VM admin password set, and the VM's addresses configured.

Data disk and first boot

Server components

Component Version Unit Listens on
Nextcloud 35.0.3 served by php8.5-fpm through nginx
nginx 1.28.3 nginx.service 0.0.0.0:80, 0.0.0.0:443
PHP FPM (OPcache, APCu) 8.5.4 php8.5-fpm.service Unix socket
PostgreSQL 18.6 postgresql@18-main.service 127.0.0.1:5432
Valkey (cache and file locking) 9.0.6 valkey-server.service 127.0.0.1:6379
Background jobs every 5 minutes nextcloud-cron.timer none
Ubuntu 26.04.1 LTS

Filesystem layout

Path What it holds
/ OS disk (30 GiB)
/var/www/nextcloud Nextcloud application, config/config.php and occ
/var/lib/nextcloud data disk (60 GiB managed disk, ext4)
/var/lib/nextcloud/data every user's files
/var/lib/nextcloud/pgsql/main the PostgreSQL 18 cluster
/etc/nginx/ssl/nextcloud.crt, .key the TLS certificate nginx serves
/root/nextcloud-credentials.txt the per-VM sign-in and database details (root only)
/mnt Azure temporary disk (lost on deallocate; nothing of Nextcloud's is here)

Managing the services

sudo systemctl restart nginx php8.5-fpm
sudo systemctl status postgresql@18-main valkey-server --no-pager
sudo systemctl list-timers nextcloud-cron.timer --no-pager

Nextcloud's own command line, occ, runs as the www-data user. For example, list the users or put the server into maintenance mode for a backup:

sudo -u www-data php /var/www/nextcloud/occ user:list
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

Logs: Nextcloud writes /var/lib/nextcloud/data/nextcloud.log (also under Administration settings > Logging), nginx writes /var/log/nginx/, and the first boot's steps are in journalctl -u nextcloud-firstboot.

Serving Nextcloud on your own domain

Nextcloud only answers on addresses in its trusted_domains list; the image trusts localhost, 127.0.0.1 and the VM's own public and private addresses. To move it to a domain name, point a DNS record at the VM, then run cloudimg's address tool, which updates trusted_domains, Nextcloud's address and the credentials file, and makes a self-signed certificate for the new name:

sudo cloudimg-set-public-address cloud.example.com

For a certificate browsers and sync apps trust, get one from your CA (for example Let's Encrypt) and install it over the shipped pair at /etc/nginx/ssl/nextcloud.crt and /etc/nginx/ssl/nextcloud.key, then reload nginx. A certificate you install there is kept: the image only replaces its own self-signed one.

sudo apt-get update && sudo apt-get install -y certbot
sudo systemctl stop nginx
sudo certbot certonly --standalone -d cloud.example.com
sudo install -m 0644 /etc/letsencrypt/live/cloud.example.com/fullchain.pem /etc/nginx/ssl/nextcloud.crt
sudo install -m 0600 /etc/letsencrypt/live/cloud.example.com/privkey.pem /etc/nginx/ssl/nextcloud.key
sudo systemctl start nginx

If the VM's public IP changes (for example after you assign a new one), run sudo cloudimg-set-public-address with no argument and it picks the new address up from Azure.

Backup and maintenance

Nextcloud's data is the files under /var/lib/nextcloud/data, the PostgreSQL database and config/config.php. Snapshot the data disk and the OS disk from the Azure portal for a full point-in-time copy, or dump the database and copy the files while the server is in maintenance mode:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
sudo -u postgres pg_dump -Fc nextcloud | sudo tee /var/backups/nextcloud-$(date +%F).dump > /dev/null
sudo tar -C /var/lib/nextcloud -czf /var/backups/nextcloud-data-$(date +%F).tar.gz data
sudo cp /var/www/nextcloud/config/config.php /var/backups/nextcloud-config-$(date +%F).php
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

Keep the OS current with sudo apt-get update && sudo apt-get upgrade; the image ships with unattended security upgrades on. Update Nextcloud itself from Administration settings > Overview, or with the updater on the command line (sudo -u www-data php /var/www/nextcloud/updater/updater.phar), after taking a backup; read Nextcloud's upgrade notes before moving to a new major version.

Troubleshooting

  • "Access through untrusted domain": you reached Nextcloud on a name or address that is not in trusted_domains. Run sudo cloudimg-set-public-address <that-name>, or list the current ones with sudo -u www-data php /var/www/nextcloud/occ config:system:get trusted_domains.
  • "finishing its first boot" page for more than a few minutes: check sudo journalctl -u nextcloud-firstboot -o cat for the step it stopped on.
  • Uploads larger than 2 GB: the desktop and mobile apps upload in chunks and are not limited; a single browser upload is limited to 2 GB per file by client_max_body_size in nginx and upload_max_filesize in PHP.
  • Warnings under Administration > Overview: Nextcloud's checks name each one with a link to its fix in the Nextcloud admin manual.

Security recommendations

  • Change the admin password after the first sign-in and enable two-factor authentication from Apps (the TOTP app) for every account.
  • Restrict 22/tcp in the NSG to your management network.
  • Install a certificate from a trusted CA before people connect sync apps.
  • Keep the data disk's snapshots or backups somewhere other than the VM.

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours, for deployment, upgrades, domain and certificate setup, sync app configuration, app installation, LDAP and SAML single sign-on, performance tuning and database administration. Email support@cloudimg.co.uk.