Toggle maintenance on or off for your Nextcloud server

How to toggle maintenance mode on or off for your Nextcloud server


By. Jacob

Edited: 2023-09-11 08:58

sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ maintenance:mode --off

Turn maintenance mode on- or off by first navigating to your Nextcloud root folder. E.g. /var/www/mynextcloud and running the relevant command. E.g:

sudo -u www-data php occ maintenance:mode --on

Like many other things, maintenance mode can be controlled with the occ CLI management tool that comes with Nextcloud.

As an alternative option that might be even safer than placing your Server in maintenance mode, you can also simply stop the relevant services and start them again when you are done performing maintenance. E.g. the Apache HTTP server:

systemctl stop apache

Due to the nature of some tasks. E.g. Switching your Nextcloud domain name or moving your Nextcloud data directory, you may want to stop the relevant services entirely until you are done.

It is also generally a good idea to put your server in maintenance mode while taking backups with tools like tar.


  1. Maintenance commands -

Tell us what you think:

  1. Prevent your Nextcloud data directory from being accessible from the internet.
  2. How to change the domain name for your Nextcloud server.
  3. How to solve a problem that causes Nextcloud to report inaccurate amount of free space.
  4. How to setup a redirect for webfinger and nodeinfo in your server configuration to make Nextcloud stop complaining about it.

More in: Nextcloud