Skip to content

Nextcloud

In this article

Information

Nextcloud is an open source server software. It allows you to create your own cloud service for data storage and collaboration. It is based on the PHP programming language and provides the ability to use various databases such as MySQL, PostgreSQL and SQLite. Nextcloud supports client-level data encryption, which ensures security while transferring data over the Internet. With the help of Nextcloud, you can synchronize data between different devices and work online and offline. Nextcloud offers an extensive set of collaboration tools such as document exchange, task management, calendars, and contacts. Nextcloud can also be integrated with other services such as Google Drive, Dropbox and Microsoft OneDrive.

Nextcloud. Key Features

Nextcloud has many features that make it an effective tool for storing and processing data:

  • File storage. Nextcloud allows you to store files on a server and access them through a web interface or through applications for desktop computers and mobile devices.
  • File synchronization. Ability to synchronize files between different devices makes the service a convenient tool for working in various conditions.
  • Version control. Nextcloud allows you to save multiple versions of the same file. It will also let you restore previous versions if needed.
  • Access to files through the web interface. Nextcloud has a web interface that allows you to access files through a browser, making it a convenient tool to work on any device.
  • Management of calendars and tasks. Nextcloud lets you create and manage calendars and tasks, making it a useful tool for organization.
  • Contact management. Nextcloud allows you to create and manage contacts, making it a handy tool for managing communications.
  • Access to files through applications. Nextcloud has applications for desktop computers and mobile devices which let you access files through them.
  • Expandability. Nextcloud has many additional applications that can be installed and used to expand the functionality. They are applications for online collaboration, document editing, project management, etc.

Deployment Features

ID Compatible OS VM BM VGPU GPU Min CPU (Cores) Min RAM (Gb) Min HDD/SDD (Gb) Active
16 Ubuntu 22.04 + + + + 2 4 40 Yes
  • Nextcloud is included in the kernel and no additional installation is required. We provide a web interface through which the service is installed and configured.
  • The configuration files are located in:
    • /opt/nextcloud - Nextcloud installation and configuration;
    • /opt/nginx - installation and configuration of Nginx service;
    • /opt/nextcloud/compose.yml - run docker compose, which starts a bunch of Nextcloud + Onlyoffice containers.
  • SSL certificate generation is based on jonasal/nginx-certbot assembly.
  • These commands may be necessary to update containers' versions and edit the configuration file.

    • To stop containers, run the command
    cd /opt/nextcloud/
    

    Then

    docker compose down
    
    • To enable containers, run the command
    cd /opt/nextcloud/
    

    Then

    docker compose up -d
    
  • Docker compose up -d runs compose.yml file, which downloads and launches the following containers:

    • db - container, PostgreSQL is downloaded, and the following settings are made:
      • The Nextcloud database (or base) is created;
      • The Nextcloud user is generated;
      • the password for SSH (it is sent in an email to your email address once the server is ready to work after deploying the software);
      • The standard port is 5432.
    • redis - container, storing calls to Nextcloud in memory and only after records in the PostgreSQL database. PotgreSQL
    • app - container, Nextcloud service has the following parameters:
      • Access to an application is carried out from a web browser or mobile app using the link https://nextcloud(server_id).hostkey.in (for example, https://nextcloud16094.hostkey.in);
      • login: admin;
      • password: from ssh;
    • onlyoffice-document-server - container, OnlyOffice service runs on port 80.

    Attention

    This container starts within 6 minutes. At this time, you can go to the Nextcloud web interface, upload and download files, but the ability to edit documents will appear only 6 minutes after running docker compose up -d (it takes some time to start some components).

    • nginx - container, Nginx service that accepts requests on ports 80 and 443 and redirects requests to the Nextcloud container.

Note

Unless otherwise specified, by default we install the latest release version of software from the developer's website or operating system repositories.

Getting started after deploying Nextcloud

A notification will be sent to the e-mail specified during registration that the server is ready for work after paying for the order. It will contain the IP address of the VPS, as well as the login and password for the connection. Clients of our company manage the hardware in the server`s and API control panel — Invapi.

You can find the authorization data either in the Info >> Tags tab of the server control panel or in the email that was sent.

  • Link to access the Nextcloud dashboard with a web interface: in the webpanel tag;
  • Login: admin;
  • Password: Sent to your email address after the server is ready for use following software deployment.

After moving to the Nextcloud control panel, you must enter your login and password:

After logging in successfully, you can start using the service.

Note

For more information on the basic settings of Nextcloud, see documentation of the developers.

Attention

To order the Nextcloud server, you should choose a server in accordance with the recommendations of the developers.

Changing the Domain name

Before starting work on changing the domain name, it is recommended to create a backup of all files specified in the instructions. To create backups of the main files, execute the following commands:

  1. Create a directory for backups

    mkdir -p /root/nextcloud_backup
    
  2. Copy the Nginx configuration file

    cp /opt/nginx/user_conf.d/nextcloud<server ID>.hostkey.in.conf /root/nextcloud_backup/
    
  3. Copy the Docker Compose file

    cp /opt/nextcloud/compose.yml /root/nextcloud_backup/
    
  4. Copy the configuration script

    cp /opt/nextcloud/set_configuration.sh /root/nextcloud_backup/
    
  5. Copy the Nextcloud configuration file

    cp /var/lib/docker/volumes/app_data/_data/config/config.php /root/nextcloud_backup/
    

These commands will create backups of all key files that will be changed during the domain name change process. In case of problems, you can restore the original configuration from these backups.

Restoring from Backups and Deleting After Successful Migration

If the domain name change process fails and you need to restore the original configuration, execute the following commands:

  1. Restore the Nginx configuration file

    cp /root/nextcloud_backup/nextcloud<server ID>.hostkey.in.conf /opt/nginx/user_conf.d/
    
  2. Restore the Docker Compose file

    cp /root/nextcloud_backup/compose.yml /opt/nextcloud/
    
  3. Restore the configuration script

    cp /root/nextcloud_backup/set_configuration.sh /opt/nextcloud/
    
  4. Restore the Nextcloud configuration file

    cp /root/nextcloud_backup/config.php /var/lib/docker/volumes/app_data/_data/config/
    
  5. Restart containers

    cd /opt/nextcloud
    docker compose down
    docker compose up -d
    
  6. Restart nginx

    docker restart nginx-certbot
    

These commands will restore all configuration files to their original state and restart the necessary services.

Once you are sure that the domain name change was successful and everything is working correctly (it is recommended to wait at least 24-48 hours for full testing), you can safely delete the backups:

  1. Check the contents of the backup directory

    ls -la /root/nextcloud_backup/
    
  2. Delete the entire backup directory

    rm -rf /root/nextcloud_backup/
    

Before deletion, it is recommended to check the directory's content to ensure you are deleting only the necessary files.

Configuring Files

  1. Connect to the server via SSH:

    ssh root@IP_ADDRESS
    
  2. Change the hostname (optional):

    hostnamectl set-hostname nextcloud_server
    
  3. Edit /etc/hosts:

    nano /etc/hosts
    

    Add a line linking the new domain to the server's IP address:

    IP_ADDRESS YOUR_DOMAIN_NAME
    

    (replace the IP address and domain name with your values)

Configuring Nginx

  1. Find and edit the Nginx configuration file:

    nano /opt/nginx/user_conf.d/nextcloud<server ID>.hostkey.in.conf
    

    Replace all instances of the old domain name (nextcloud<server ID>.hostkey.in) with the new one (YOUR_DOMAIN_NAME):

    • Line 4: server_name nextcloud<server ID>.hostkey.in;server_name YOUR_DOMAIN_NAME;
    • Line 15: server_name nextcloud<server ID>.hostkey.in;server_name YOUR_DOMAIN_NAME;
    • Line 17: ssl_certificate /etc/letsencrypt/live/nextcloud<server ID>.hostkey.in/fullchain.pem;ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN_NAME/fullchain.pem;
    • Line 18: ssl_certificate_key /etc/letsencrypt/live/nextcloud<server ID>.hostkey.in/privkey.pem;ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN_NAME/privkey.pem;
    • Line 19: ssl_trusted_certificate /etc/letsencrypt/live/nextcloud<server ID>.hostkey.in/chain.pem;ssl_trusted_certificate /etc/letsencrypt/live/YOUR_DOMAIN_NAME/chain.pem;
  2. Rename the configuration file:

    mv /opt/nginx/user_conf.d/nextcloud<server ID>.hostkey.in.conf /opt/nginx/user_conf.d/YOUR_DOMAIN_NAME.conf
    
  3. Restart the Nginx container:

    docker restart nginx-certbot
    

Configuring Nextcloud

  1. Edit the Docker Compose file:

    nano /opt/nextcloud/compose.yml
    

    Replace all instances of the old domain name with the new one (YOUR_DOMAIN_NAME). Pay attention to lines containing:

    • Line 40: - OVERWRITECLIURL=https://nextcloud<server ID>.hostkey.in/
    • Line 41: - OVERWRITEHOST=nextcloud<server ID>.hostkey.in
  2. Edit the Nextcloud configuration script:

    nano /opt/nextcloud/set_configuration.sh
    

    Replace all instances of the old domain name with the new one. Pay particular attention to lines:

    • Line 11: if ! grep -q "nextcloud<server ID>.hostkey.in" trusted_domain.tmp; then
    • Line 13: docker exec -u www-data app-server php occ --no-warnings config:system:set trusted_domains $TRUSTED_INDEX --value="nextcloud<server ID>.hostkey.in"
    • Line 23: docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice StorageUrl --value="https://nextcloud<server ID>.hostkey.in/

Applying Changes

  1. Navigate to the Nextcloud directory:

    cd /opt/nextcloud
    
  2. Stop and remove existing containers:

    docker compose down
    

    This command will stop and remove all containers defined in the compose.yml file but will retain all data in volumes.

  3. Start Nextcloud containers:

    docker compose up -d
    
  4. Run the configuration script:

    bash /opt/nextcloud/set_configuration.sh
    

    If the script reports an error that the command "maintenance:install" is not defined, this is normal—Nextcloud has already been installed.

Checking and Debugging

  1. Verify that Nextcloud is accessible via the new domain name:

    Open your browser to https://YOUR_DOMAIN_NAME

  2. If there are issues, check the logs:

    docker logs nginx-certbot
    docker logs app-server
    
  3. Manually configure trusted_domains if necessary:

    docker exec -u www-data app-server php occ --no-warnings config:system:set trusted_domains 1 --value="YOUR_DOMAIN_NAME"
    docker exec -u www-data app-server php occ --no-warnings config:system:set overwrite.cli.url --value="https://YOUR_DOMAIN_NAME/"
    
  4. If OnlyOffice is used, verify its settings:

    docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice StorageUrl --value="https://YOUR_DOMAIN_NAME/"
    

Important Notes

  • After making changes, it is essential to clear your browser cache;
  • All user credentials remain the same as before changing the domain name;
  • If your DNS provider requires time for record updates, some delay may occur before the new domain name starts working;
  • Ensure that the A-record in DNS points to the correct IP address of your server;
  • The PTR record (reverse DNS) is not critical for Nextcloud's operation but can be updated through the control panel for full consistency.

Ordering Nextcloud using the API

To install this software using the API, follow these instructions.


Some of the content on this page was created or translated using AI.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×