Nextcloud: Difference between revisions

From David's Wiki
Tag: Manual revert
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Nextcloud is a self-hosted cloud solution.
Nextcloud is a self-hosted cloud storage and file sharing solution.  
It is a fork of ownCloud by the original founder.


It is open-source under AGPL-3.
It is open-source under AGPL-3.
Line 20: Line 19:


The '''easy''' way is to create a symlink:
The '''easy''' way is to create a symlink:
<pre>
<syntaxhighlight lang="bash">
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
mkdir -p /new/path/to/data
mkdir -p /new/path/to/data
Line 29: Line 28:
chown -R www-data:www-data /new/path/to/data # To set actual data dir ownership
chown -R www-data:www-data /new/path/to/data # To set actual data dir ownership
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off
</pre>
</syntaxhighlight>


===Caching===
===Caching===
Line 36: Line 35:
You should use caching to achieve a reasonable performance.   
You should use caching to achieve a reasonable performance.   
NextCloud recommends APCu for local caching and Redis for lock caching:
NextCloud recommends APCu for local caching and Redis for lock caching:
<pre>
<syntaxhighlight lang="php">
'memcache.local' => '\OC\Memcache\APCu',
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
Line 44: Line 43:
     'port' => 6379,
     'port' => 6379,
],
],
</pre>
</syntaxhighlight>
 
===Troubleshooting===
 
====Large Files====
Rclone is useful for transferring large files over Webdav. However, you need to make sure the server is set up for it.
 
To transfer large files, double check the following:
* Apache body limit is at least 512 MB. Set the following in your Dockerfile:
*: <syntaxhighlight lang="Dockerfile">
RUN echo "LimitRequestBody 0" > /etc/apache2/conf-enabled/nextcloud-apache.conf
</syntaxhighlight>
* Nginx does not have a body limit and is not proxying requests or responses. In ingress-nginx, set the following annotations:
*:<syntaxhighlight lang="yaml">
annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "86400"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "86400"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
    nginx.ingress.kubernetes.io/proxy-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
</syntaxhighlight>


==Markdown==
==Markdown==
Line 54: Line 74:


Markdown does not have a Latex app.
Markdown does not have a Latex app.
==Apache==
{{hidden | Example Apache Config |
For best performance, you should disable certain modules as listed [https://docs.nextcloud.com/server/latest/admin_manual/issues/general_troubleshooting.html in the troubleshooting section of the guide.]
<pre>
<VirtualHost *:80>
  ServerName cloud.davidl.me
  ServerSignature Off
  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName cloud.davidl.me
  ServerSignature Off
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/nextcloud
  # Disable mod_deflate for nextcloud.
  SetEnv no-gzip 1
  <IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
  </IfModule>
  ErrorLog ${APACHE_LOG_DIR}/cloud_davidlme_error.log
  CustomLog ${APACHE_LOG_DIR}/cloud_davidlme_access.log combined
  # SSL Stuff here
</VirtualHost>
</pre>
}}

Latest revision as of 02:00, 6 July 2023

Nextcloud is a self-hosted cloud storage and file sharing solution.

It is open-source under AGPL-3.

Administration

Configuration

The primary configuration file is config/config.php.
You can view a list of configuation parameters here.

I recommend adding the following to your configuation file:

  • 'simpleSignUpLink.shown' => false, disables some sign up links which direct to nextcloud.com.

Moving data directory

See https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170

Nextcloud doesn't include a clean built-in way to migrate data.

The proper way to do it is to fix all the paths in the Nextcloud database. However, this is slightly complicated and prone to errors.

The easy way is to create a symlink:

sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
mkdir -p /new/path/to/data
rsync -a /path/to/data/. /new/path/to/data
mv /path/to/data /path/to/dataBackup
ln -s /new/path/to/data /path/to/data
chown -h www-data:www-data /path/to/data # To set symlink ownership
chown -R www-data:www-data /new/path/to/data # To set actual data dir ownership
sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off

Caching

See Caching configuration.

You should use caching to achieve a reasonable performance.
NextCloud recommends APCu for local caching and Redis for lock caching:

'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
     'host' => 'localhost',
     'port' => 6379,
],

Troubleshooting

Large Files

Rclone is useful for transferring large files over Webdav. However, you need to make sure the server is set up for it.

To transfer large files, double check the following:

  • Apache body limit is at least 512 MB. Set the following in your Dockerfile:
    RUN echo "LimitRequestBody 0" > /etc/apache2/conf-enabled/nextcloud-apache.conf
    
  • Nginx does not have a body limit and is not proxying requests or responses. In ingress-nginx, set the following annotations:
    annotations:
        nginx.ingress.kubernetes.io/proxy-body-size: "0"
        nginx.ingress.kubernetes.io/proxy-connect-timeout: "86400"
        nginx.ingress.kubernetes.io/proxy-read-timeout: "86400"
        nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
        nginx.ingress.kubernetes.io/proxy-buffering: "off"
        nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
    

Markdown

NextCloud comes with its own WYSIWYG markdown editor.
If you prefer to type markdown yourself, do the following:

  1. Disable the "Text" app
  2. Install the "Plain text editor" app
  3. Install the "Markdown Editor" app

Markdown does not have a Latex app.