Privacy Tutorials

How to Install Nextcloud on A Shared Hosting Server

How to Install Nextcloud on A Shared Server

Build your own cloud storage for free using Nextcloud. Here’s a step by step guide showing how to install Nextcloud on a shared hosting server.

Cloud storage has gained huge popularity in recent years. Companies like Google, Apple, Dropbox, Microsoft etc. are providing us with different plans to choose from. All these companies offer some cloud storage for free and different apps to synchronize your data between your devices.

While these cloud storage services offer ease of use, there’s also a concern of privacy that comes with using them. Google leads the pact with accusations of using our data — be it our browsing history, emails or documents — to monetize their products. The company offers plenty of their products for free but makes sure to earn revenue from us by using various monetizing methods.

In recent years, I have grown more and more conscious about my digital privacy. If you don’t mind your data being used to make someone else rich, then these privacy concerns might not bother you. But if they do, then it’s about time you start believing in the value of your data and taking measures to protect your privacy online.


In my previous article, I talked about privacy-focused VPNs. In other recent articles, I have talked about protecting digital privacy and privacy-friendly Google Analytics alternatives. Now in this article, I will show you how to build your own cloud server using Nextcloud — an opensource project that lets your build self-hosted cloud servers for free. You may also be interested in some cloud services with zero-knowledge end-to-end encryption.

Before diving into the ‘how’ of this, you should familiarise yourself with the ‘why’ of it. If you don’t know what is Nextcloud, go ahead and read about it first. Once you are familiar with it and understand why you should use Nextcloud, it’s time to move forward.

Installing Nextcloud on a Shared Server

I will assume that you are already aware of the fact that Nextcloud does not provide storage on its own. It’s a software that will allow you to build your own cloud — a software which you will install on your server. This server could be a fully-owned server at your home/office premise or hosted on a rented space by a web host.

Please note that building your Nextcloud server on your own hardware is not the focus of this tutorial. It focuses on installing Nextcloud on a shared server which can act as a replacement to a cloud service like Google Drive. By using a server that you are already paying for hosting your website, you will be saving money because you are utilising the same server resources.

Before you begin, keep in mind that:

You need to have a shared server already up and running. This could be any shared server purchased from a web host that is already hosting your website(s), emails etc. I am using DreamHost as my hosting provider.

Building a cloud server and using it to backup your documents, photos and other files could be restricted by your host. For example, DreamHost does not permit using their storage for backup purpose. The storage usage must be a part of an active website according to their policy. Make sure to clear this with your host first. I have used DreamHost for demonstration only.

You should have some knowledge of operating the cPanel interface, setting up a domain or subdomain, creating MYSQL database, and FTP.

Step 1: Creating a Domain or Subdomain

You have three options to choose from while deciding where to install Nextcloud.

1. A primary domain (yourdomain.com)
2. A subdomain (cloud.yourdomain.com)
3. A directory under your domain (yourdomain.com/cloud)

The installation steps remain the same regardless of the option chosen. In my example, I will install my Nextcloud instance on the subdomain cloud.techstuffer.com. For this to work, I will create the subdomain in my DreamHost panel.

Creating A Subdomain on DreamHost

Depending on your host, it may take some time before your domain/subdomain is activated and ready for further steps. After your domain/subdomain is ready, install a TLS certificate (a free Let’s Encrypt certificate works). After this, your domain should be available via HTTPS.

Step 2: Setting Up A Database

Find the MySQL Database section in your hosting panel and create a new database. Make a note of your database name, hostname, username, and password. You will need this during Nextcloud installation.

Creating MySQL Database for NextCloud

Step 3: Downloading and Installing Nextcloud

Right click here and save the Nextcloud Web Installer (setup-nextcloud.php file) on your computer.

Establish an FTP connection to your server or use WebFTP/file manager option (if your web host offers it) and navigate to the directory where you want Nextcloud to be installed. I will browse to the following directory – /home/myusername/cloud. This is the same directory which I used while creating my subdomain (see screenshot in Step 1).

Now upload the setup-nextcloud.php file to this directory.

After that, point your browser to this file. I will open the following URL for my example: https://cloud.techstuffer.com/setup-nextcloud.php. You should see the following screen.

Installing Nextcloud on a Shared Server

Click Next.

The installer will now check for dependencies. If all looks good, it will say All Nextcloud dependencies found.

On the same screen it asks you to choose where you want to install your Nextcloud instance.

Here you can enter a directory (default: nextcloud) which will install Nextcloud to this path: https://subdomain.yourdomain.com/nextcloud.

To make it easier to navigate to, I don’t want to install my Nextcloud under a subdirectory. In order to install it in the same directory as my subdomain, I will enter a dot (.) here which will install my Nextcloud to https://cloud.techstuffer.com.

Installing Nextcloud on a Shared Server

Click Next and wait while Nextcloud is being installed. If all went well, you should see the success message. Click Next again.

Now enter an admin account and password for your Nextcloud. This user will have all administrative rights for your cloud installation. I recommend against using a simple username like admin. Choose a strong password too.

After this, click Storage and database. Leave Data Folder field unchanged and click MySQL.

Now enter the database information you noted down in Step 2. This includes database user and its password, database name, and hostmame.

Nextcloud Installation on a Shared Server

Click Finish Setup and wait for the process to finish, after which, you will see your Nextcloud directory.

What Next?

After your Nextcloud instance is installed, you can start creating directories and uploading your files. You can do so by opening your cloud URL (https://cloud.techstuffer.com) in a web browser or use Nextcloud apps for Windows, macOS, Linux, Android or iOS — just like you would with other cloud services like Google Drive or Dropbox.

Nextcloud Installation

Beside uploading your files, you can use Nextcloud for plenty of other things. You can sync your contacts and calendar, share files with others, use it for note-taking, run an email client and a lot more. You can install apps for different tasks by navigating to Apps section.

You can also enable the server-side encryption by going to Settings > Security.


Installing Nextcloud on a Shared Server: Summary

Building your own cloud server using Nextcloud is easy. You can choose to run your cloud on a dedicated hardware owned by you or rent server space from a web host.

There are many web hosts that provide shared hosting plans for cheap rates. You may already have a shared hosting plan and utilise its space and bandwidth without paying extra for an additional server. A Nextcloud instance can be installed on its dedicated domain, a subdomain or a subdirectory.

After setting up, you can use Nextcloud just like you use other cloud services like Google Drive or Dropbox. You can synchronise your files on multiple devices and share them with others or use it as a backup for your data among other things.

That’s all, folks. This was a step by step tutorial showing how to install Nextcloud on a shared server. I hope you found it useful and I’d like to thank you for reading.

Written By

Parvez Shaikh

I started blogging as a teenage hobby and now enjoy it full time. On Tech Stuffer, I share my views and knowledge on digital privacy, blogging, gadgets etc. while also continuing travel writing and photography.

4 Comments

  • Wonderful guide, thank you. I am also on Dreamhost, so this was very helpful. One question though: the installation leaves you with a few security & setup warnings in Settings > Administration > Overview. See below. Were you able to fix this?

    The PHP memory limit is below the recommended value of 512MB.
    The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds. For enhanced security, it is recommended to enable HSTS as described in the security tips ↗.

    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 is not properly configured. For better performance it is recommended to use the following settings in the php.ini:

    opcache.enable=1
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=128
    opcache.save_comments=1
    opcache.revalidate_freq=1

    The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.
    Missing index “calendarobject_calid_index” in table “oc_calendarobjects_props”.
    Missing index “schedulobj_principuri_index” in table “oc_schedulingobjects”.
    Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running ‘occ db:convert-filecache-bigint’ those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read the documentation page about this.
    mounts.storage_id
    mounts.root_id
    mounts.mount_id

    • Hi Bart. I am glad this guide helped. I was able to solve PHP limit and ppcache warnings.

      First find out which php version you are running on your NextCloud installation from Settings > Administration > System.

      Then navigate to the root directory of your hosting account using FTP client or Dreamhost’s WebFTP option and find .php directory. Enter the directory of your php version. Mine is version 7.2. Edit the phprc file to include the following before “this line was added by…” text:

      upload_max_filesize = 1000M
      post_max_size = 205M
      max_execution_time = 500
      max_input_time = 500
      max_input_vars = 10000
      memory_limit = 512M

      opcache.enable=1
      opcache.interned_strings_buffer=8
      opcache.max_accelerated_files=10000
      opcache.memory_consumption=128
      opcache.save_comments=1
      opcache.revalidate_freq=1

      Then save the file. This should solve php limit and opcache warnings.

      Memcached is only available for Dremhost dedicated hosting so you can’t do anything about it on shared server. Just ignore this.

      HSTS is optional I haven’t enabled it.

      About the database missing indexes, I don’t see these warning and not sure how to solve it. Please see the documentation or ask for help in the NextCloud community.

      Hope this helps.

      • Hi Parvez,

        I am running the latest version of PHP that DH offers: 7.4. I have found the php folder you mentioned and added the lines. Thank you for the tip. The message is still there though, but I guess it may take some time before my NC will pick it up. There is no way to restart the NC services or installation, is there?

        I managed to create the missing indexes by using PuTTY and issuing the command “php occ db:add-missing-indices” from within the nextcloud folder. I couldn’t do the conversion to big int, as that requires the db to be offline and I have not figured out yet how to do that.

        Again, many thanks for your help! 🙂

        Bart

        • Thanks for the update Bart. I don’t think we can restart the services because it’s a shared server. But the message should go away soon. You can keep an eye on the Settings > Administration > System page to see if it has the new memory limit.

Leave a Comment