Skip to content
Search

NextCloud

lastmod 2025-11-17created 2018-08-2131 edits

Nextcloud is client-server software for developing and using file hosting services. It offers comprehensive support options for enterprise use. It is free and open-source software, and anyone can install and operate their own private server device.

Backup & Restore

Maintenance mode

Maintenance mode (maintenance:mode locks the sessions of logged-in users and prevents new logins to avoid data inconsistencies. On Ubuntu Linux, you must run occ as the HTTP user, as in the following example.

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

You can also put the server into this mode by editing config/config.php.

Change "maintenance" => false to "maintenance" => true

When maintenance is finished, you must turn off maintenance:mode.

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

Docker exec

To enter with docker's exec command, enter as follows.

docker exec -u www-data -it [CONTAINER_ID] /bin/bash

occ command location

(Probably short for OwnCloud-Command?) It is located at /var/www/html/occ.

Manually file upload

To upload files manually, proceed as follows.

First, put the files in the /var/www/html/data/{사용자ID}/files directory.

Then scan the files with the following command.

$ sudo -u www-data php occ files:scan --all

If you are using docker, run it as follows.

$ docker exec -u www-data {컨테이너ID} php occ files:scan --all

The output looks like this.

Starting scan for user 1 out of 3 (aaa)
Starting scan for user 2 out of 3 (public)
Starting scan for user 3 out of 3 (bbb)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 387     | 10056 | 00:00:49     |
+---------+-------+--------------+

INFORMATION

This method also works when you have manually removed files that could not be deleted because of a FileLocked error

After upgrading: additional migration tasks and resolving security and setup warnings

Reverse proxy header configuration

역방향 프록시 헤더 설정이 올바르지 않거나 신뢰하는 프록시를 통해 Nextcloud에 접근하고 있을 수 있습니다. 만약 Nextcloud를 신뢰하는 프록시를 통해 접근하고 있지 않다면 이는 보안 문제이며 공격자가 Nextcloud에 보이는 IP 주소를 속이고 있을 수 있습니다. 자세한 내용은 [https://docs.nextcloud.com/server/20/admin_manual/configuration_server/reverse_proxy_configuration.html 문서]를 참고하십시오.

Enable HSTS

"Strict-Transport-Security" HTTP 헤더가 "15552000"초 이상으로 설정되어 있지 않습니다. 보안 팁에서 제안하는 것처럼 HSTS를 활성화하는 것을 추천합니다.

Missing indices

occ db:add-missing-indices

The database is missing some primary keys

The database is missing some primary keys. Due to the fact that adding primary keys on big tables could take some time they were not added automatically. By running "occ db:add-missing-primary-keys" those missing primary keys could be added manually while the instance keeps running.

    Missing primary key on table "oc_federated_reshares".
    Missing primary key on table "oc_systemtag_object_mapping".
    Missing primary key on table "oc_comments_read_markers".
    Missing primary key on table "oc_collres_resources".
    Missing primary key on table "oc_collres_accesscache".
    Missing primary key on table "oc_filecache_extended".

For the warning above, run the command as described.

occ db:add-missing-primary-keys

Some database columns have not been converted to Big Int

일부 데이터베이스 열이 Big Int로 변환되지 않았습니다. 큰 테이블의 열 형식을 변환하는 데 시간이 걸리기 때문에 자동으로 변환하지 않았습니다. 명령행에서 "occ db:convert-filecache-bigint" 명령을 실행하여 변경 사항을 직접 적용할 수 있습니다. 이 작업은 인스턴스를 오프라인으로 전환하고 실행해야 합니다. 더 많은 정보를 보려면 문서 페이지를 참조하십시오.

    federated_reshares.share_id
    share_external.id
    share_external.parent

For the warning above, run the command as described.

occ db:convert-filecache-bigint

Depending on the number of files in the instance, this can take up to several hours!

Reverse proxy

When you put a Reverse proxy such as traefik in front, the web root path may be wrong. You can pin the related settings by editing the config/config.php file.

  • overwritehost: Sets the hostname of the proxy. You can also specify a port.
  • overwriteprotocol: Sets the protocol of the proxy. You can choose between two options, http and https.
  • overwritewebroot: Sets the absolute web path of the proxy to the Nextcloud folder.
  • overwritecondaddr: Overwrites the values depending on the remote address. The value must be a regular expression of the proxy IP addresses. This is useful when you want to use a reverse SSL proxy only for https access and auto-detection for http access.

If you leave the value empty or omit the parameter, it is auto-detected.

If you use docker, check the environment variables below:

  • OVERWRITEHOST (empty by default): Set the hostname of the proxy. Can also specify a port.
  • OVERWRITEPROTOCOL (empty by default): Set the protocol of the proxy, http or https.
  • OVERWRITEWEBROOT (empty by default): Set the absolute path of the proxy.
  • OVERWRITECONDADDR (empty by default): Regex to overwrite the values dependent on the remote address.

Traefik 1

Using docker tags:

traefik.frontend.redirect.permanent: 'true'
traefik.frontend.redirect.regex: https://(.*)/.well-known/(card|cal)dav
traefik.frontend.redirect.replacement: https://$$1/remote.php/dav/

NGINX

location /.well-known/carddav {
    return 301 $scheme://$host/remote.php/dav;
}

location /.well-known/caldav {
    return 301 $scheme://$host/remote.php/dav;
}

Onlyoffice install

$ cd apps/

Get the Nextcloud ONLYOFFICE integration app. There are several ways to do that:

  • Download the latest signed version from the official store for Nextcloud.
  • Or you can download the latest signed version from the application release page on GitHub.
  • Or you can clone the application source code and compile it yourself:
$ git clone https://github.com/ONLYOFFICE/onlyoffice-nextcloud.git onlyoffice

Change the owner to update the application right from Nextcloud web interface:

$ chown -R www-data:www-data onlyoffice

Secret key

See Onlyoffice#NextCloud Secret key.

Configuring Nextcloud ONLYOFFICE integration app

Onlyoffice-nextcloud-public.jpg

Note that, as in the figure above, the Document Server must be reachable from the Public Web.

Also, if you install the Document Server app, you don't need to prepare a separate server.

How to reinstall Onlyoffice

Proceed in the following order.

  • Remove the OnlyOffice app in the Nextcloud web UI.
  • Go to the <path to your NC>/apps folder on the server. With a docker installation, it is /var/www/html/apps.
  • Download the plugin:
  • Unpack the archive:
    • sudo -u www-data tar xvf onlyoffice.tar.gz
  • Change file permissions:
    • sudo -u www-data find ./onlyoffice -type d -exec chmod 0750 {} \;
    • sudo -u www-data find ./onlyoffice -type f -exec chmod 0640 {} \;
  • Enable the OnlyOffice app in the Nextcloud web UI.

Troubleshooting

Fixing slowness on the first file list screen right after login

  • Don't use Recommendations. Either disable it in the plugins, or, on the first file list screen right after login, click the settings icon at the bottom left and uncheck the Show recommendations checkbox.
  • Also uncheck the Show rich workspace checkbox.

The "documentType" parameter for the config object is invalid

Right after upgrading to OnlyOffice 7.3.0, the following error occurs when selecting a file.

The "documentType" parameter for the config object is invalid. Please correct it.

So let's downgrade to 7.1.2. See #How to reinstall Onlyoffice above.

See also

Favorite site

author Zer0 sitemap