NextCloud is open source software for mainly handling file hosting services. In this article we will see how to install NextCloud on CyberPanel with Docker. We will create NextCloud Docker container and then use rewirte rules to proxy traffic to this container.
Step 1: Open Docker on CyberPanel
In First Step open CyberPanel dashboard on your browser and look for Docker Manager, under Docker Manager you can click any link such as Manage Images, and it will redirect you to installation page (only if Docker is not already installed).
Step 2: Download/Pull NextCloud Image
Once Docker is installed now you have to search for NextCloud image. For the NextCloud image click on the Manage Images link, where you can easily search and pull the image. As you can see the search option in the landing page, here you can type NextCloud for image which is publicly available on Docker hub. Pull the Nextcloud image then image will be listed as locally available.
And select tag: docker.io/nextcloud:stable:apache, you can see NextCloud image is locally available after being pulled.
Step 3: Create Docker Container for Nextcloud Image
After installing Docker and pulling Nextcloud image, you are now ready to create your Docker Container for Nextcloud. Docker containers are just running instances of Docker Images.
Now click on the link of New Container under Docker Manager. Once the image and tag is selected hit the create button.
After Clicking Create button you will see the page below:
NextCloud image use **/var/www/**html to store the application data, you can map this as volume to your Docker Host, so that data is persisted between container reboots. We mapped this path to /home/nextcloud.cyberpanel.net/public_html/nextcloud.
In your case you can create website from CyberPanel and use its document root as path for volume mapping such as /home/yourdomain.com/public_html/nextcloud
We choose 9000 to be exposed as port from this container. Make sure that port you choose are not used by any other process. Finally click Create Container. If creation went successful you will be redirected to the container page where you can manage different aspects of container. By default container is in created state, you can click start to change its state to running.
Now that the container is running, you can use rewrite rules to proxy traffic to this container. Detailed instrucstions are available on the below article:
REVERSE PROXY TRAFFIC TO DOCKER CONTAINER ON CYBERPANEL
Make sure to use port 9000 in your proxy configurations, so that traffic is properly redirected to the container.
Once rewrite rules are configured, visit your domain and you should see the following page, you can then configure your NextCloud installation.