That question can easily been answered. Check-out the link to the Administrator Guide and a related forum discussion:
https://docs.nextcloud.com/server/latest/admin_manual/maintenance/upgrade.html?highlight=upgrade#how-to-upgrade