Tel.: +49 9152 408 639 4 - Mail: info (at) danielwenzlik.com

Install Nextcloud 21 in Plesk

Nextcloud Login Screen

In this tutorial post I’ll show you how to properly install the new Nextcloud in version 21 on a Plesk server.

Step 1: Install Redis (via SSH):

sudo apt-get install redis-server

Step 2: Create a subdomain in Plesk

Plesk create subdomain

Step 3: Empty the directory & upload the setup file

filemanager Plesk

You can download the current setup file from Nextcloud and simply drag and drop it onto your server using the file manager.

Step 4: Apache & NGINX settings

nginx-settings

With this tutorial we only use the NGINX web server. But so that Nextcloud does not issue any error messages, we have to add additional instructions in the “Additional nginx directives” field:

rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
 rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
 add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
 location = /.well-known/carddav {
     return 301 /remote.php/dav;
 }
 location = /.well-known/caldav {
     return 301 /remote.php/dav;
 }
 location ^~ /.well-known {
     return 301 /index.php$uri;
 }
 location = /robots.txt {
     allow all;
     log_not_found off;
     access_log off;
 }
 Enable gzip but do not remove ETag headers
 gzip on;
 gzip_vary on;
 gzip_comp_level 4;
 gzip_min_length 256;
 gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
 gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
 location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
     deny all;
 }
 location ~ ^\/(?:.|autotest|occ|issue|indie|db_|console) {
     deny all;
 }
 location ~ ^\/(?:updater|ocs-provider)(?:$|\/) {
     try_files $uri/ =404;
     index index.php;
 }
 Adding the cache control header for js and css files
 location ~ .(?:css|js|woff2?|svg|gif)$ {
     try_files $uri /index.php$request_uri;
     add_header Cache-Control "public, max-age=15778463";
     add_header X-Content-Type-Options nosniff;
     add_header X-XSS-Protection "1; mode=block";
     add_header X-Robots-Tag none;
     add_header X-Download-Options noopen;
     add_header X-Permitted-Cross-Domain-Policies none;
     add_header Referrer-Policy no-referrer;
 }
 location ~ .(?:png|html|ttf|ico|jpg|jpeg)$ {
     try_files $uri /index.php$request_uri;
 }

Step 5: PHP settings

performance-settings-php

For the PHP setting “open_basedir” we set the following value:

{WEBSPACEROOT}{/}{:}{TMP}{/}:/dev/urandom:/proc/meminfo
PHP-FPM Settings Plesk

Here, too, we have to enter some values in the “Additional directives” field:

opcache.enable_cli=1
 opcache.interned_strings_buffer=8
 opcache.max_accelerated_files=10000
 opcache.memory_consumption=128
 opcache.save_comments=1
 opcache.revalidate_freq=1
 

Step 6: edit PHP.INI:

So that we can upload the full 2 GB, we have to store the following instruction in the PHP.INI file:

[webserver] 
nginxClientMaxBodySize = 2048M

Step 7: Create a database:

Plesk Database Setup

Step 8: Install Nextcloud

To install, enter the subdomain you have just created in the browser and then append “/setup-nextcloud.php” to the URL, then you will see the following screen:

Nextcloud 21 Setup #1

With a click on “Next” we come to the 2nd step of the installation, in which we enter a simple “.” in the text field:

Nextcloud 21 Setup #2

This step can take a few moments, so just let the browser do it. If the installation was successful, we see the following output:

Nextcloud 21 Setup #3

In the next step we assign a username for the administrator and a password. Below we select MariaDB / MySQL and enter the database data from step 7:

Nextcloud 21 Setup #4

With a click on “Complete installation”, Nextcloud creates a database and user, this step can take a long time.

Step 9: edit the Nextcloud config file:

In the filemanager and the root directory of our Nextcloud installation we find the folder “config”, in this folder we find the file “config.php”. We open it and add the following text:

'memcache.distributed' => '\OC\Memcache\Redis',
   'memcache.local' => '\OC\Memcache\Redis',
   'memcache.locking' => '\OC\Memcache\Redis',
   'redis' => 
   array (
     'host' => 'localhost',
     'port' => 6379,
   ),

… at the following point in the file:

Nextcloud 21 config.php

Step 10: create cronjob:

CronJob in Plesk anlegen

The installation of Nextcloud 21 is now complete. In my case I still get an error message that my PHP module Imagick does not support SVG file types. Since I don’t have a test server at the moment, I will submit a fix for it when my upgrade on the live system is done.

I am happy to help you with problems, just send me a message via my contact page.

Pictures: © Daniel Wenzlik
Total
1
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts