Running NextCloud Docker AIO on a Plesk server / VPS

The recommended way to run a self hosted NextCloud instance is using the All in One Docker image officially provided by Nextcloud GmbH (see as described on their website ( see

If you have a server running Plesk and want to use the official aio docker image as described above there are a few pitfalls, but basically everything should run smoothly if you follow my instructions below.

I assume you already have a docker deamon up and running and created a domain / subdomain through plesk that is fitted with a ssl certificate. As plesk is running and there is (to my knowledge) no way to completely overwrite settings in a way to directly expose the NextCloud AIO docker container to the public, we’ll need to find a way to proxy the requests through nginx. As plesk is defaultly running in a mode where it proxies requests through nginx to apache, this is not going to be a problem.

There is a special documentation about running NextCloud behind a proxy, as this is not considered the default mode of the NextCloud AIO docker image. You can find the complete guide at with a pre configured compose file at that can be adjusted to your needs. Basically my compose file looks like this:

Basic compose.yml file for NextCloud AIO docker image behind an nginx reverse proxy

    image: nextcloud/all-in-one:latest
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
      - /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
      - 8080:8080
    environment: # Is needed when using any of the options below
      # - AIO_DISABLE_BACKUP_SECTION=false # Setting this to true allows to hide the backup section in the AIO interface. See
      - APACHE_PORT=11000

volumes: # If you want to store the data on a different drive, see
    name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work

Please refer to the example compose file in the link above to further adjust this to your settings, as this is only the basic configuration you’ll need to make nextcloud run behind a reverse proxy. This will make nextclouds’ apache container serve on port 11000, hence this is where we’ll proxy our requests to.

Configuring plesk to only run nginx as a proxy for the NextCloud AIO docker image

In plesk, go to the domain you wan’t to server NextCloud under. It is not possible to run NextCloud in subdirectory, as the authors of NextCloud did not intent for it to do so, so you’ll definitley need a domain with a valid ssl certificate which you can acquire through plesk via Let’s Encrypt ( Now go to your domain in Plesk and under “Hosting & DNS” choose “Apache & nginx”.

The first thing you’ll want to do is to uncheck the proxy mode, which will turn off Apache for this domain overall. We only need nginx to proxy our requests to the NextCloud AIO docker container. Next we’ll want to add additional nginx directives to tell nginx to actually proxy our requests:

location ~ ^/.* {

	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Port $server_port;
	proxy_set_header X-Forwarded-Scheme $scheme;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header Accept-Encoding "";
	proxy_set_header Host $host;

	client_body_buffer_size 512k;
	proxy_read_timeout 86400s;
	client_max_body_size 0;

	# Websocket
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection $connection_upgrade;

Disabling php is important for NextCloud to run in docker under Plesk

In Plesk go to the Dashboard under your domain and under “Dev Tools” choose “PHP”. There you’ll need to uncheck PHP support. Otherwise NextCloud will not work properly as Plesk automatically generates directives in the nginx configuration which will interfere with NextCloud. If you’re NextCloud is working in general but producing various 404 errors whilst working with it, there is probably still some problem with nginx directives coming directly from Plesk. I discovered it when the NextCloud Frontend tried to send xhr requests to the URI ocs/v2.php which resulted in a Not Found error.

Adding required nginx variables to the server config

As we’ll need to tell nginx about the variables we used in the additional directives and we cannot do it there (we’ll be in a section where this is not allowed), we’ll need to add this mapping manually. This requires root access to your servers config files. In my knowledge there is no way to do this directly via Plesk, which is why I added the configuation manually. To not interfere with Plesk (which is regularly recreating configuration files), I added a new file called map.conf to nginxs’ conf.d directory.

# this file is /etc/nginx/conf.d/map.conf
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;

Now all you need to do is to tell nginx to reload it’s config by executing the following command:

nginx -s reload

That’s it! You can now fire up NextCloud AIO Docker Image and follow the instructions from the manual, it is pretty straight forward from here on.






Leave a Reply

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