doc/pages/01.administrate/04.learn/06.apps/02.apps/nextcloud/app_nextcloud.md

177 lines
6.5 KiB
Markdown
Raw Normal View History

2020-11-11 11:47:10 +01:00
---
title: Nextcloud
template: docs
taxonomy:
2020-11-14 14:14:50 +01:00
category: docs, apps
2020-11-11 11:47:10 +01:00
---
<img src="/images/nextcloud_logo.png" alt="logo de Nextcloud"> Nextcloud
2019-07-30 07:08:15 +02:00
- [Discovering the Nextcloud environment](#EnvironmentNextcloud)
- [Mobile and computer client software](#ClientSoftware)
- [Useful Manipulations & Problems Encountered](#UtileManipulations)
- [Add space to Nextcloud](#AddSpace)
- [Third Party Applications](#AppsTiers)
- [Useful links](#UsefulLinks)
2019-07-30 07:08:15 +02:00
2020-09-30 18:19:44 +02:00
Nextcloud is a file hosting service, many applications can be installed to offer it new features such as a calendar, a directory, notes and many others (you can find some applications in the [third-party applications](#AppsTiers) part but there are many others depending on your needs).
## Discovering the Nextcloud environment <a name="EnvironmentNextcloud" href=""></a>
Due to the creation of Nextcloud, a database with third-party applications to install, this chapter will only concern the nextcloud database without added applications. More information on applications in the dedicated section or in the nextcloud application catalogue: [apps.nextcloud.com](https://apps.nextcloud.com).
Nextcloud is before a cloud service (like Seafile and others), it allows synchronization and file sharing on the Internet and between several terminals (computers, smartphone) but also with several people.
## Mobile and computer client software <a name="ClientSoftware" href=""></a>
There are client software for all platforms. You can find them on the official nextcloud website: https://nextcloud.com/install/#install-clients
## Useful Manipulations & Problems Encountered <a name="UtileManipulations" href=""></a>
### Add storage space <a name="AddSpace" href=""></a>
Solution I. allows you to add a link to a local or remote folder.
2020-09-14 15:32:07 +02:00
Solution II. allows to move the main storage space of Nextcloud.
#### I. Add an external storage space
2019-07-30 07:08:15 +02:00
Parameter =>[Administration] External storage.
At the bottom of the list you can add a folder (It is possible to define a subfolder using the `folder/subfolder` convention.)
Select a storage type and specify the requested connection information.
You can restrict this folder to one or more nextcloud users with the column `Available for`.
With the gear you can allow or prohibit previewing and file sharing.
Finally click on the check mark to validate the folder.
#### II. Migrate Nextcloud data to a larger partition
2019-07-30 07:08:15 +02:00
2020-03-28 06:54:10 +01:00
**Note**: The following assumes that you have a hard disk mounted on `/media/storage`. Refer to[this article](/external_storage) to prepare your system.
2019-07-30 07:08:15 +02:00
**Note**: Replace `nextcloud` with the name of its instance, if you have several Nextcloud apps installed.
First turn off the web server with the command:
```bash
systemctl stop nginx
```
##### Choice of location
2019-07-30 07:08:15 +02:00
**Case A: Blank storage, exclusive to Nextcloud**
2019-07-30 07:08:15 +02:00
2020-09-14 15:32:07 +02:00
For the moment only root can write to it in `/media/storage`, which means that NGINX and Nextcloud will not be able to use it.
2019-07-30 07:08:15 +02:00
```bash
chown -R nextcloud:nextcloud /media/storage
chmod 775 -R /media/storage
```
**Case B: Shared storage, data already present, Nextcloud data in a subfolder**
2019-07-30 07:08:15 +02:00
If you want to use this disk for other applications, you can create a subfolder belonging to Nextcloud.
```bash
mkdir -p /media/storage/nextcloud_data
chown -R nextcloud /media/storage/nextcloud_data
chmod 775 -R /media/storage/nextcloud_data
```
##### Migrate data
2019-07-30 07:08:15 +02:00
Migrate your data to the new disk. To do this *(be patient, it can take a long time)*:
```bash
2019-09-23 16:07:41 +02:00
Case A: cp -ia /home/yunohost.app/nextcloud /media/storage
Case B: cp -ia /home/yunohost.app/nextcloud /media/storage/nextcloud_data
2019-07-30 07:08:15 +02:00
```
The `i` option allows you to ask yourself what to do if there is a file conflict, especially if you overwrite an old Owncloud or Nextcloud data folder.
2019-07-30 07:08:15 +02:00
To check that everything went well, compare what these two commands display (the content must be identical):
```bash
ls -la /home/yunohost.app/nextcloud
Case A: ls -al /media/storage
Case B: ls -al /media/storage/nextcloud_data/nextcloud
```
##### Configure Nextcloud
2019-07-30 07:08:15 +02:00
To inform Nextcloud of its new directory, modify the `/var/www/nextcloud/config/config.php` file with the command:
```bash
nano /var/www/nextcloud/config/config.php
2019-07-30 07:08:15 +02:00
```
Look for the line:
```bash
'datadirectory' => '/home/yunohost.app/nextcloud/data',
```
That you modify:
```bash
CASE A:'datadirectory' =>'/media/storage',
CASE B:'datadirectory' =>'/media/storage/nextcloud_data/nextcloud/data',
```
Back up with `ctrl+x` then `y` or `o` (depending on your server locale).
Restart the web server:
```bash
systemctl start nginx
```
Add the.ocdata file
```bash
CASE A: nano /media/storage/.ocdata
CASE B: nano /media/storage/nextcloud_data/nextcloud/data/.ocdata
```
Add a space to the file to be able to save it
Back up with `ctrl+x` then `y` or `o` (depending on your server locale).
Run a scan of the new directory by Nextcloud:
```bash
cd /var/www/nextcloud
sudo -u nextcloud php7.3 occ files:scan --all
2019-07-30 07:08:15 +02:00
```
It's over now. Now test if everything is fine, try connecting to your Nextcloud instance, upload a file, check its proper synchronization.
### Nextcloud and Cloudflare
2019-07-30 07:30:08 +02:00
2021-01-01 17:25:17 +01:00
If you use Cloudflare for your DNS, *which may be useful if you have a dynamic IP*, you will most likely have authentication problems with the Nextcloud application. On the Internet many people propose to create a rule that disables all options related to security and Cloudflare speed for the URL pointing to your Nextcloud instance. Although it works, it is not the optimal solution. I propose, certainly to create a rule for the URL pointing to your Nextcloud instance but to disable only 2 options. So here's how:
2019-07-30 07:30:08 +02:00
#### Cloudflare Page Rules
2019-07-30 07:30:08 +02:00
In the Cloudflare control panel select your domain and find Page Rules
2020-09-14 15:32:07 +02:00
the URL in your address bar will look like this: https://dash.cloudflare.com/*/domain.tld/page-rules
2019-07-30 07:30:08 +02:00
2019-09-30 09:50:08 +02:00
##### Add a rule
2019-07-30 07:30:08 +02:00
2020-09-14 15:32:07 +02:00
The rule to be added must apply to the URL of your Nextcloud instance either:
2019-07-30 07:30:08 +02:00
- `https://nextcloud.domain.tld/**` if you use a subdomain
2020-09-14 15:32:07 +02:00
- `https://domain.tld/nextcloud/*` if you have deployed Nextcloud in a directory
2019-07-30 07:30:08 +02:00
The options to disable (Off) are:
- Rocket Loader
- Email Obfuscation
2020-09-14 15:32:07 +02:00
Save and clean your caches (Cloudflare, browser...) and that's it.
## Third Party Applications <a name="AppsTiers" href=""></a>
2019-09-30 09:50:08 +02:00
- [Calendrier](app_nextcloud_calendar)
2020-09-14 15:32:07 +02:00
- [Contact](app_nextcloud_contact)
2019-09-30 09:50:08 +02:00
- [KeeWeb](app_nextcloud_keeweb)
- [Carnet](app_nextcloud_carnet)
## Useful links <a name="UsefulLinks" href=""></a>
2020-09-14 15:32:07 +02:00
- Official website: [nextcloud.com](https://nextcloud.com/)
- Application catalogue for Nextcloud: [apps.nextcloud.com](https://apps.nextcloud.com/)