nextcloudpleskVPS

How to install Nextcloud 14 within Plesk via Web-Installer

Today we will install Nextcloud 14 into a Plesk vHost

If we have root access to the server, we can also use redis-server as memcache.

The following command installs the appropriate package:

sudo apt-get install redis-server

Prepare vHost:

In Plesk we create the subdomain under domains:

 

 

and secure it with LetsEncrypt:

 

 

Within the subdomain we use the file manager:

 

 

and remove all files and directories:

 

 

Now we have to download the Nextcloud-Webinstaller from the following URL to our workstation:

Nextcloud Webinstaller

Afterwards we upload it to our Webspace in Plesk:

 

In Apache/NGINX settings of the subdomain, we set the following values for HTTP Additional Instructions (Customize Domain / Subdomain):

<Directory /var/www/vhosts/domain.tld/nextcloud.domain.tld/>
 AllowOverride All
</Directory>

 

in Additional settings for HTTPS we set the following directives:

 

Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"

 

NGINX-Settings:

 

 

Under certain circumstances, some operating systems have a case-sensitivity problem, so we put the following block under Use Static Files Directly Through nginx:

ac3 avi bmp bz2 css cue dat doc docx dts eot exe flv gif gz htm html ico img iso jpeg jpg js mkv mp3 mp4 mpeg mpg ogg pdf png ppt pptx qt rar rm svg swf tar tgz ttf txt wav woff woff2 xls xlsx zip AC3 AVI BMP BZ2 CSS CUE DAT DOC DOCX DTS EOT EXE FLV GIF GZ HTM HTML ICO IMG ISO JPEG JPG JS MKV MP3 MP4 MPEG MPG OGG PDF PNG PPT PPTX QT RAR RM SVG SWF TAR TGZ TTF TXT WAV WOFF WOFF2 XLS XLSX ZIP

and into Additional NGINX-Instructions we add the following block:

 

ssl_prefer_server_ciphers On;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5;

gzip_proxied any;
# enable gzip compression
gzip on;
gzip_min_length 20;
gzip_buffers 4 32k;
gzip_types text/plain text/javascript application/javascript application/x-javascript text/xml text/css application/js;
gzip_vary on;
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|json|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|OGG|OGV|SVG|SVGZ|EOT|OTF|WOFF|MP4|TTF|CSS|RSS|ATOM|JS|JPG|JPEG|JSON|GIF|PNG|ICO|ZIP|TGZ|GZ|RAR|BZ2|DOC|XLS|EXE|PPT|TAR|MID|MIDI|WAV|BMP|RTF)$ {
expires max; log_not_found off;
# time out settings
proxy_connect_timeout 3600s;
proxy_send_timeout   3600s;
proxy_read_timeout   3600s;
fastcgi_read_timeout 3600s;
# webdav rewrite
rewrite ^/.well-known/carddav /remote.php/dav/ permanent;
rewrite ^/.well-known/caldav /remote.php/dav/ permanent;
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
}

 

In PHP settings we set the version to 7.2.x and enter the following value under OPEN-Base-Dir:

 

{WEBSPACEROOT}{/}{:}{TMP}{/}:/dev/urandom:/proc/meminfo

 

in section disable_functions you have to delete opcache_get_status and insert none.

Don’t forget to adjust the upload_max_filesize and post_max_size values.

as example we can use the following values if you want to upload files not greater than 2 GB:

 

 

At the bottom of the page under Additional configuration instructions, we set following parameters:

 

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

 

Among the hosting settings, we have to set the 301 redirect (http to https):

 

 

Prepare Database

 

Add a database within the subdomain:

 

 

and accept or adjust the following settings and write them down for later use:

 

 

Finish the installation

 

Via the web browser, we call our Nextcloud-Webinstaller and complete the Installation now:

https://nextcloud.your-domain.tld/setup-nextcloud.php

In the next step, we enter a single „.“ into the field:

And after another click on „Next“, we should see the success of the installation:

The next step is to adjust the settings:

 

If we are logged in, we have to edit the config.php in config directory in Plesk via File Manager and insert the following block for the cache (if redis is installed):

 

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

 

If we have ssh-access (as root or Plesk-User), then we can create a CRON job (adjust user):

 
as root:

sudo crontab -u admin -e

 

as Plesk-User:

crontab -e

and enter the following line (customize domain and subdomain):

 

*/15 * * * * php -f /var/www/vhosts/domain.tld/nextcloud.domain.tld/cron.php

 

Sometimes it is also possible to add a task via the GUI:

Otherwise, we use an external WebCron service, for example EasyCron.

The URL that needs to be called is:

 

https://nextcloud.domain.tld/nextcloud/cron.php

 
Among the basic settings, we check Nextcloud for errors and subsequently also in Plesk in the subdomain under logs.

Optional: Pretty-URL:

Optional you are able to rewrite the URL from https://nextcloud.your-domain.tld/index.php/... to https://nextcloud.your-domain.tld/...

Edit the config.php in your nextcloud-vHost and add or extend the following lines (important: slash at the end of url in first line):

'overwrite.cli.url' => 'https://nextcloud.your-domain.tld/',
  'htaccess.RewriteBase' => '/',

then execute the following command in your shell:

sudo -u admin php /var/www/vhosts/your-domain.tld/nextcloud.your-domain.tld/occ maintenance:update:htaccess

If you have problems or questions, suggestions, don’t hesitate to contact me.

See you and happy Nextclouding 🙂

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.