How to install Nextcloud 16 within Plesk with nginx only

Changes 09.05.2019
– Add links to „Install Nextcloud with Beta-Extension „Nextcloud“

In this Howto I will show you to install Nextcloud 16 on a Plesk VPS with nginx only
If you want to install Nextcloud via the Extension „Nextcloud“ (Beta-State) then follow this guides:
webdeasy English-Version
webdeasy German Version

Then come back and switch to nginx-only.

Nextcloud recommends the use of a MemoryCache. If we have ssh-access to our server, we install redis for this. Redis is an in-memory database with a simple key-value data structure and belongs to the family of NoSQL databases.
If you want to know more, follow this link.

The following command installs the appropriate package:

sudo apt-get install redis-server

please check the status of redis:

sudo systemctl status redis


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

Before we upload it to our Webspace in Plesk, we have to edit the following line in an editor of our choice:

Change from:

// Nextcloud version
define('NC_VERSION', '15.0.2');


// Nextcloud version
define('NC_VERSION', '16.0.0');

and then upload:


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

rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";

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

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

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/ 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;





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




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:



Then set pm to dynamic and adjust, as example:


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



env[PATH] = /usr/local/bin:/usr/bin:/bin


To allow uploading large files, we have to adjust the nginxClientMaxBodySize in panel.ini of Plesk:
We can do this in two ways, the easiest way is to edit the file with nano:

sudo nano /opt/psa/admin/conf/panel.ini

and we add the following content:

nginxClientMaxBodySize = 2048M

or you can install the „Panel.ini Editor“-Extension of Plesk and edit the file in Plesk:

Do not to forget to save this file.

Among the hosting settings, we have to set the 301 redirect (http to https) and run php set to FPM Application served by nginx:



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:


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 behind the „Trusted Domains-Array“ (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,


it should look like this:

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

you can find the user in the domain view of plesk:

as example with my User as root:

sudo crontab -u -e


if you have ssh-Access as Plesk-User „“ than:

crontab -e

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

for php7.2:

*/15    *       *       *       *       /opt/plesk/php/7.2/bin/php -f 'nextcloud.your-domain.tld/cron.php' > /dev/null

for php7.3:

*/15    *       *       *       *       /opt/plesk/php/7.3/bin/php -f 'nextcloud.your-domain.tld/cron.php' > /dev/null

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:



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

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

See you and happy Nextclouding 🙂

22 Gedanken zu „How to install Nextcloud 16 within Plesk with nginx only

  1. every time I restart my server when I do a migration or if I want to import the database it gives me this error:
    stderr: ERROR 1071 (42000) at line 153: Specified key was too long; max key length is 767 bytes

    for a walk around I did this:
    Plesk db
    SET GLOBAL innodb_file_format=Barracuda;
    SET GLOBAL innodb_file_per_table=on;
    SET GLOBAL innodb_large_prefix=on;

    and I can carry on with the import, but when I restart the server it goes again.

    i have tried to uninstall PHP 7.2 and 7.3
    and reinstall them
    I tried to put the cloud on 7.3 it gave me bad gateway error
    on 7.2 it works, but for some reason I can’t use my password, I tried to reset it, but it doesn’t work

  2. here is the Redis status

    sudo systemctl status redis
    ● redis-server.service – Advanced key-value store
    Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2019-05-18 12:31:59 CEST; 1 day 3h ago
    Main PID: 1518 (redis-server)
    Tasks: 4 (limit: 9490)
    CGroup: /system.slice/redis-server.service
    └─1518 /usr/bin/redis-server

      1. Hi Markus

        PHP 7.3.5
        the first migration from ubuntu 16.04 to ubuntu 18.04 everything was perfect
        the second migration from ubuntu 18.04 to ubuntu 18.04 it started giving me the same error.

        all php versions and settings are equal, I did a migration from Plesk itself

      2. I’m sorry I gave you the wrong log of Redis, please delete my comments.

        this is the correct actual server with the problem:

        sudo systemctl status redis
        ● redis-server.service – Advanced key-value store
        Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
        Active: active (running) since Sun 2019-05-19 15:05:45 CEST; 1h 38min ago
        Main PID: 1288 (redis-server)
        Tasks: 4 (limit: 9490)
        CGroup: /system.slice/redis-server.service
        └─1288 /usr/bin/redis-server

        May 19 15:05:45 systemd[1]: Starting Advanced key-value store…
        May 19 15:05:45 systemd[1]: Started Advanced key-value store.

    1. May 18 12:31:58 systemd[1]: Starting Advanced key-value store…
      May 18 12:31:58 systemd[1]: redis-server.service: Can’t open PID file /var/run/redis/ (yet?) after start: No such file or dir
      May 18 12:31:59 systemd[1]: Started Advanced key-value store.

  3. Hello Markus,

    i have a problem when I migrate from a server to another, I have installed Redis and its running,
    i do everything and copy everything but when it comes to make changes on the config file. it gives me this error:

    Internal Server Error
    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log.

    I tried to setup a new instance, everything goes well until I change the config file.
    I’m using ubuntu 18.04.2.

    here is the log:

    {„reqId“:“dMa2QhPveIaXF9zNOitY“,“level“:3,“time“:“2019-05-19T14:25:30+00:00″,“remoteAddr“:“″,“user“:“–„,“app“:“core“,“method“:“GET“,“url“:“\/index.php“,“message“:{„Exception“:“OC\\HintException“,“Message“:“Memcache \\OC\\Memcache\\Redis not available for local cache“,“Code“:0,“Trace“:[{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Server.php“,“line“:510,“function“:“__construct“,“class“:“OC\\Memcache\\Factory“,“type“:“->“,“args“:[„2f5a05d433b9c2e1dcb899a7f08edd6a“,{„__class__“:“OC\\Log“},“\\OC\\Memcache\\Redis“,“\\OC\\Memcache\\Redis“,“\\OC\\Memcache\\Redis“]},{„file“:“\/var\/www\/vhosts\/\/\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php“,“line“:118,“function“:“OC\\{closure}“,“class“:“OC\\Server“,“type“:“->“,“args“:[„*** sensitive parameters replaced ***“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/ServerContainer.php“,“line“:125,“function“:“offsetGet“,“class“:“Pimple\\Container“,“type“:“->“,“args“:[„OC\\Memcache\\Factory“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php“,“line“:165,“function“:“query“,“class“:“OC\\ServerContainer“,“type“:“->“,“args“:[„OC\\Memcache\\Factory“]},{„file“:“\/var\/www\/vhosts\/\/\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php“,“line“:114,“function“:“OC\\AppFramework\\Utility\\{closure}“,“class“:“OC\\AppFramework\\Utility\\SimpleContainer“,“type“:“->“,“args“:[„*** sensitive parameters replaced ***“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/ServerContainer.php“,“line“:125,“function“:“offsetGet“,“class“:“Pimple\\Container“,“type“:“->“,“args“:[„MemCacheFactory“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Server.php“,“line“:1541,“function“:“query“,“class“:“OC\\ServerContainer“,“type“:“->“,“args“:[„MemCacheFactory“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Server.php“,“line“:473,“function“:“getMemCacheFactory“,“class“:“OC\\Server“,“type“:“->“,“args“:[]},{„file“:“\/var\/www\/vhosts\/\/\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php“,“line“:118,“function“:“OC\\{closure}“,“class“:“OC\\Server“,“type“:“->“,“args“:[„*** sensitive parameters replaced ***“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/ServerContainer.php“,“line“:125,“function“:“offsetGet“,“class“:“Pimple\\Container“,“type“:“->“,“args“:[„OCP\\IURLGenerator“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php“,“line“:165,“function“:“query“,“class“:“OC\\ServerContainer“,“type“:“->“,“args“:[„OCP\\IURLGenerator“]},{„file“:“\/var\/www\/vhosts\/\/\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php“,“line“:114,“function“:“OC\\AppFramework\\Utility\\{closure}“,“class“:“OC\\AppFramework\\Utility\\SimpleContainer“,“type“:“->“,“args“:[„*** sensitive parameters replaced ***“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/ServerContainer.php“,“line“:125,“function“:“offsetGet“,“class“:“Pimple\\Container“,“type“:“->“,“args“:[„URLGenerator“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Server.php“,“line“:1514,“function“:“query“,“class“:“OC\\ServerContainer“,“type“:“->“,“args“:[„URLGenerator“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Server.php“,“line“:986,“function“:“getURLGenerator“,“class“:“OC\\Server“,“type“:“->“,“args“:[]},{„file“:“\/var\/www\/vhosts\/\/\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php“,“line“:118,“function“:“OC\\{closure}“,“class“:“OC\\Server“,“type“:“->“,“args“:[„*** sensitive parameters replaced ***“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/ServerContainer.php“,“line“:125,“function“:“offsetGet“,“class“:“Pimple\\Container“,“type“:“->“,“args“:[„OC\\Template\\JSCombiner“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/TemplateLayout.php“,“line“:330,“function“:“query“,“class“:“OC\\ServerContainer“,“type“:“->“,“args“:[„OC\\Template\\JSCombiner“]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/TemplateLayout.php“,“line“:160,“function“:“findJavascriptFiles“,“class“:“OC\\TemplateLayout“,“type“:“::“,“args“:[[„core\/js\/dist\/main“,“js\/merged-template-prepend“,“search\/js\/search“,“core\/l10n\/it“,“search\/l10n\/it“,“search\/js\/searchprovider“,“js\/files\/fileinfo“,“js\/files\/client“]]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/legacy\/template.php“,“line“:183,“function“:“__construct“,“class“:“OC\\TemplateLayout“,“type“:“->“,“args“:[„error“,““]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/Template\/Base.php“,“line“:131,“function“:“fetchPage“,“class“:“OC_Template“,“type“:“->“,“args“:[]},{„file“:“\/var\/www\/vhosts\/\/\/lib\/private\/legacy\/template.php“,“line“:332,“function“:“printPage“,“class“:“OC\\Template\\Base“,“type“:“->“,“args“:[]},{„file“:“\/var\/www\/vhosts\/\/\/index.php“,“line“:61,“function“:“printExceptionErrorPage“,“class“:“OC_Template“,“type“:“::“,“args“:[{„__class__“:“OC\\HintException“},500]}],“File“:“\/var\/www\/vhosts\/\/\/lib\/private\/Memcache\/Factory.php“,“Line“:99,“Hint“:“Is the matching PHP module installed and enabled?“,“CustomMessage“:“–„},“userAgent“:“Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit\/605.1.15 (KHTML, like Gecko) Version\/12.1 Safari\/605.1.15″,“version“:“″}
    {„reqId“:“dMa2QhPveIaXF9zNOitY“,“level“:3,“time“:“2019-05-19T14:25:30+00:00″,“remoteAddr“:“yy.yy.yy.yy“,“user“:“–„,“app“:“PHP“,“method“:“GET“,“url“:“\/index.php“,“message“:“You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/vhosts\/\/\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18″,“userAgent“:“Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit\/605.1.15 (KHTML, like Gecko) Version\/12.1 Safari\/605.1.15″,“version“:“″}

    1. redis-cli> ping

      i don’t know if (sudo apt-get install php-redis) is installed or not, do I need to install it?

          1. Double Check the nginx and php-settings. Also hosting settings, when you use nginx then everything have to adjusted with equal settings „nginx with php-fpm“. Sometimes this settings are both adopt by all settings-pages.

          2. OK. You migrated from plesk with Ubuntu 16.04 to plesk with 18.04 and it works, right? And then to another plesk with 18.04 and then it doesn’t Work, right? There is a difference between this two Ubuntu 18.04 hosts. Have you tried PHP 7.1 also?

        1. when I remove the lines from the config file, it works but it gives me these notes:

          There are some warnings regarding your setup.
          PHP does not seem to be setup properly to query system environment variables. The test with getenv(„PATH“) only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.
          No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the documentation.
          The PHP OPcache module is not loaded. For better performance it is recommended to load it into your PHP installation.
          This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
          Please double check the installation guides ↗, and check for any errors or warnings in the log.
          Check the security of your Nextcloud over our security scan ↗.

          1. 7.1 works!

            yes there is a difference, the third one of ubuntu 18.04 its a reconfigured image of ubuntu 18.04 + Plesk preinstalled.
            the second one which worked before I have installed the Plesk from zero.

            do u think that I should remove Plesk and reinstall it?

          2. It is always a good thing to install plesk from scratch. I used a preinstalled environment one time and some things were very confused. So I decided to reset this one to a preinstalled ubuntu, adjust this one and then I installed plesk with plesk Installer. After that everything was allright.

          3. the problem is that don’t give me the ability to install Plesk alone, and the command: Plesk installer –remove-everything works only on CentOS, so I’m now installing CentOS. :/
            i have never used it, I hope that the commands will not be a pain for me.

            or I can try the ubuntu 16.04 preinstalled like before, without problems

  4. Hallo Markus, ich weiß es passt nicht ganz zum Thema aber:
    Wäre es möglich eine Anleitung zu schreiben wie ich auf einem Debian 9 mit Plesk Onyx und MariaDB 10.1.38 ein Upgrade auf MariaDB 10.2 mache? Ich habe das hier gefunden ->
    Oder sind es echt nur die zwei Befehle?? Oo
    mysql -V
    mysql Ver 15.1 Distrib 10.2.19-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

    Execute this command to update package version inside Plesk:

    plesk bin service_node –update local

    Ich wäre dir sehr dank bar für eine Antwort

Schreibe einen Kommentar

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