How to Setup a Raspberry Pi Nextcloud Server

For this project, we will be showing you how to setup and configure a Raspberry Pi NextCloud Server. This server can act as your own personal "cloud" storage system.

Raspberry Pi Nextcloud Server

As time goes on the protection of your own privacy with 3rd party companies becomes harder and harder. This is where software like Nextcloud comes in hand, as it gives you full control over your files with no 3rd party controller.

It is important to remember that since your data will be stored on your local network you will end up using a lot of bandwidth when uploading and downloading files from outside your local network. If your internet connection is not great then you may not get the best experience if you plan on using it outside your local network.

If this looks familiar then that’s because it likely is, Nextcloud is an actively maintained fork of the owncloud software that I have previously covered. The longer it’s in development the more different these two software packages will likely become, I suggest looking into both and then deciding on which one to go with.

If you want to learn more about Nextcloud, you can check out the nextcloud website.

Note: The USB ports on a Raspberry Pi are typically unable to power an external hard drive. If you find this the case and your hard drive doesn’t use an external power supply, then I recommend looking into buying a powered USB hub for the Pi.

Equipment List

You can find all the bits and pieces that I used/recommend for this Raspberry Pi Nextcloud tutorial right below.



Table of Contents

We recommend starting from the first topic and working through each in chronological order. However, if you need, you can skip to a specific topic if required.

Installing Apache and PHP

To run Nextcloud on the Raspberry Pi we will first need to install and setup Apache and PHP.

We won’t be going too in-depth into installing these as they are a minor components to this tutorial.

If you want to learn more about setting up a Web Server, then be sure to follow our tutorial on how to do this.

For the best performance I recommend using Raspbian lite but just normal Raspbian will also work just as well.

If you need information on how to set this all up check out the guide in the Pi operating systems section.

For this tutorial, we will make use of the latest available version of PHP 8.

1. To get started let’s first update our package repositories with the following command:

sudo apt update
sudo apt upgrade

2. With that done, let’s now install apache with the following command:

sudo apt install apache2

You can check to make sure Apache2 is successfully up and running by going to your Pi’s IP address, this should load a default Apache Page.

If you are unsure on what your Raspberry Pi’s local IP address is then type in hostname -I into the terminal.

3. For this tutorial, we will be using PHP 8.2 as at the time of writing that is the recommended version for Nextlcoud.

To gain access to this version of PHP you will need to add a third-party PHP repository by following our guide.

4. With Apache2 now installed onto the Raspberry Pi, we just need to install PHP and several of its packages.

To install PHP and the packages we need, run the following command.

sudo apt install php8.2 php8.2-gd php8.2-sqlite3 php8.2-curl php8.2-zip php8.2-xml php8.2-mbstring php8.2-mysql php8.2-bz2 php8.2-intl php8.2-smbclient php8.2-imap php8.2-gmp php8.2-bcmath libapache2-mod-php8.2

5. With Apache and PHP now installed there is one final thing we need to do, and that is to restart Apache.

You can do this now making use of the following command:

sudo service apache2 restart

Setting up a MySQL Database and User for Nextcloud

In this section we will be showing you how to set up a user and database for Nextcloud to use to store its data.

Before beginning this section you must have set up a MySQL server on your Raspberry Pi already.

1. The first thing we need to do is open the MySQL command line tool by running the following command.

We will be using this command line tool to create a user and database for MySQL.

sudo mysql -u root -p

2. Once you have logged in to the tool, we can start by creating a database.

We will be creating this database called nextclouddb by running the following command.

CREATE DATABASE nextclouddb;

3. Our next step is to create a user that we will be using to interact with our new database.

We will be creating a user called nextclouduser by running the command below. Make sure that you replace [PASSWORD] with a secure password and make note of it for later.

CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY '[PASSWORD]';

4. With our user created we need to now give it permissions to interact with our database.

We can do that by running the following command.

GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextclouduser'@'localhost';

This command grants the user nextclouduser all privileges on the nextclouddb database and all of its tables.

5. Our final task is to flush the privilege table.

To flush the privileges all we need to do is run the following command.


With this done, we can now proceed to install Nextcloud on our Raspberry Pi.

Downloading Nextcloud on your Raspberry Pi

Getting Nextcloud on your the Raspberry Pi is quite simple, it mainly involves downloading the zip file from their website, extracting it and then making some .

1. To get started let’s first move to our html directory with the following change directory command.

cd /var/www/

2. Now we can download the latest version of Nextcloud to our device.

To do this we will use wget to download the latest release to the current folder.

sudo wget

3. With Nextcloud now downloaded to our Raspberry Pi, let us extract the archive.

To extract the archive using tar we need to use the command below.

sudo tar -xvf latest.tar.bz2

4. We now need to create a data directory for Nextcloud to operate in, for the initial setup of Nextcloud we must make this folder in our html/nextcloud directory.

Create the directory by using the mkdir command as shown below:

sudo mkdir -p /var/www/nextcloud/data

5. Now let’s give the correct user and group control over the entire Nextcloud folder and everything inside it by running the following chown command.

sudo chown -R www-data:www-data /var/www/nextcloud/

6. Finally we need to give it the right permissions, again run the following chmod command.

sudo chmod 750 /var/www/nextcloud/data

Configuring Apache for Nextcloud

Next, we need to deal with the .htaccess file for Nextcloud.

Since we installed Nextcloud into the default Apache2 directory /var/www/, we will need to change some settings in Apache2 to allow the .htaccess file to override settings.

To handle this just for the Nextcloud directory we will be creating a new configuration file for Apache.

1. To get started let’s create a file which will store our configuration changes for Nextcloud:

sudo nano /etc/apache2/sites-available/nextcloud.conf

2. Now before you proceed any further you will need to decide whether you want Nextcloud to run under the “/nextcloud” directory or on its own domain or subdomain.

Running Under a Directory

If you want NextCloud to be accessible whenever someone goes to “/nextcloud” then all you need to do is type in the following lines into the file.

This configuration is simple and means whenever someone goes to your Pi’s IP address, followed by “/nextcloud” they will be greeted with its interface.

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  <IfModule mod_dav.c>
    Dav off


Running NextCloud on its own domain

If you would prefer Nextcloud to be run under a separate domain name or a subdomain, then you need to create a virtual host as shown below.

When typing in these configuration lines make sure you replace “” with the domain name you plan on using.

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud/

  <Directory /var/www/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    <IfModule mod_dav.c>
      Dav off

3. These lines basically tell Apache2 how to handle itself within the /var/www/nextcloud/ folder.

These changes will allow Apache2 to read and utilize the .htaccess files within the Nextcloud directory.

4. Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then ENTER.

5. With the file created we now need to tell Apache to make use of it.

We can do this by utilizing the a2ensite command followed by nextcloud.conf.

sudo a2ensite nextcloud.conf

6. Now we need to restart Apache2 to force it to read in the updated configuration file. We can do that easily with the following command:

sudo systemctl reload apache2

With that done you can now move on to setting up the Nextcloud software within its web interface.

Nextcloud Initial Setup

1. Now that we have finished with that we can now finally go to Nextcloud itself and begin its installation process.

To begin go to your Raspberry Pi’s IP address plus /nextcloud.

If you don’t know your Raspberry Pi’s IP address you can make use of the command hostname -I.

Remember to replace [IPADDRESS] with that of your Raspberry Pi’s.


Please note, if you are running this under a domain name you will need to go to that instead of what we have shown above.

2. You will now be greeted with the following screen.

Here you will need to type in the Username and Password (1.) that you intend to use for your admin account.

If you plan on allowing your Nextcloud file service to be accessible from outside your network, make sure that you use a long and secure password.

Next, we need to specify the details for our database server. To get to these options you will need to click the “Storage & Datbase” option (2.).

Now you need to slect the type of database we want to use. As we are using an SQL server click the “MySQL/MariaDB” (3.) option.

Finally we need to enter the details for our database server. There are three bits of information that we will need to enter.

  1. The username for the user that will interact with our database server. (A.) If you are using the same information we used, this setting should be set to nextclouduser.
  2. The password that you set for the above user. (B.)
  3. The final option you will need to set is the database name. (C.) If you have been following our guide this will be nextclouddb.

Once you are happy with this, press the “Finish Setup” button (4.), please note this can take some time to complete as it finalises your setup.

Raspberry Pi Nextcloud Set up Screen

3. After this you should now be greeted with the following welcome screen, this just lays out the various programs you can use to connect with your Nextcloud installation.

Just click the X button in the top right corner to continue.

Nextcloud Welcome Screen

4. Now you can finally see the interface of the Raspberry Pi Nextcloud, you should take some time to familiarize yourself with all the functionality of Nextcloud’s interface.

We won’t go too in depth on how to use the Nextcloud interface, if you need more information then I recommend checking out the support section on nextcloud.

We have however highlighted some of the key areas to check out in the screenshot below.

Nextcloud Files Screen

Moving Nextcloud’s Data Folder

With Nextcloud now safely installed we can now tweak the setup to both be more secure and a bit more useable. One of the first things we should do is move the data directory so it does not sit in our web accessible directory.

This is also the same way you would move your Nextcloud data directory onto a larger external hard drive rather than putting increased load onto the Raspberry Pi’s SD Card.

1. To get started let’s make our new directory for where we will store our data files.

To make it easy we will make a new folder at /var/nextcloud and move our data folder into there.

Create the folder by running the following command:

sudo mkdir -p /var/nextcloud

2. With our new folder we created we will now move our data directory into it, this is easy to do thanks to the mv command.

Please note that your Nextcloud system will be out of action while we move the file then adjust the configuration file.

To begin the move type in the following command:

sudo mv -v /var/www/nextcloud/data /var/nextcloud/data

3. Now with the files moved over we can now modify the datadirectory configuration to point to our new directory.

First, let’s change to the config directory for Nextcloud with the following command.

cd /var/www/nextcloud/config

4. We can now copy the config file to make a backup of the file, we can do this with the following command:

sudo cp -p config.php config.php.bk

5. Finally let’s open up the config.php file for editing using nano.

sudo nano config.php

6. Within this file we need to change the following line:

'datadirectory' => '/var/www/nextcloud/data',


'datadirectory' => '/var/nextcloud/data',

7. Now we can save and quit out of the file by pressing CTRL + X then Y and then ENTER.

8. As one last precuation we should make sure that the www-data user still has ownerships over our new folder.

sudo chown -R www-data:www-data /var/nextcloud/data

You should be able to now refresh your web browser and all your files should be showing exactly as they were previously.

Increasing Nextcloud’s Max Upload Size

By default, PHP has a very low upload limit, so low it’s only 2 MB. To change this, we need to modify the php.ini file and increase the limit. A cloud storage system wouldn’t be very useful if you could only ever upload 2mb files.

1. To get started we need to begin editing the configuration file with the following command:

sudo nano /etc/php/8.2/apache2/php.ini

2. Now we need to find and replace the following two lines.

post_max_size = 8M
upload_max_filesize = 2M


post_max_size = 1024M
upload_max_filesize = 1024M

Of course, you can set the file size limits to something that is much higher than 20M, so feel free to change that number to whatever you think is the maximum size file you will upload to your Nextcloud.

3. Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then ENTER.

Now we need to restart Apache2 to force it to read in the updated configuration file. We can do that easily with the following command:

sudo service apache2 restart

4. You should now be able to restart your web browser and begin a new upload to see that the maximum upload size has been increased successfully.

Setting up SSL for Nextcloud

Now we should really work on setting up your Raspberry Pi Nextcloud server so that it runs through HTTPS and not plain HTTP.

For this tutorial, we will assume that you do not have a domain name, so we will be generating our own self signed certificate and not utilizing one from a free service such as Letsencrypt.

1. Before we go modifying our Apache2 configuration we will first generate the self-signed certificate, luckily, we can do this all in one command thanks to OpenSSL.

Remember that a self-signed certificate will throw errors in your web browser and is not as secure as a properly signed certificate but it is better than nothing. It is also the only option if you’re not utilizing a domain name.

Before we generate the certificate, let’s first make a directory to store it.

sudo mkdir -p /etc/apache2/ssl

2. Now let’s generate the certificate itself by running the following command in the terminal:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

If you want to know exactly what these command arguments do, then read our little description below.

req: This specifies a subcommand for X.509 certificate signing request (CSR) management.

-x509: This option specifies that we want to make a self-signed certificate file instead of generating a certificate request.

-nodes: This tells the openssl application that we don’t want to specify a passphrase, a passphrase will require us to enter it every time Apache is restarted which is painful to deal with.

-days 365: This specifies the amount of days we want the certificate to remain valid for, after this amount of days you will have to generate a new certificate.

-newkey rsa:4096: This will create the certificate request and a new private key at the same time. You will need to do this since we didn’t create a private key in advance. The rsa:2048 tells OpenSSL to generate an RSA key that is 2048 bits long.

-keyout: This parameter names the output file for the private key file that is being created.

-out: This option names the output file for the certificate that we are generating.

After pressing enter you will be presented with the following options to fill out.

Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:

3. Once you have filled out all that information we can then proceed on with setting up Apache2 to run SSL and to also utilize our newly generated certificate. This is a simple process but an important one.

First let’s enable the SSL module for Apache with the following command:

sudo a2enmod ssl

4. Now we need to modify the default-ssl.conf file so it will utilize our new certificates and not the default ones that are generated by OpenSSL on installation.

To begin modifying this file run the following command:

sudo nano /etc/apache2/sites-available/default-ssl.conf

5. Within this file we need to change the two lines below to point to our new certificates we generated into our /etc/apache2/ssl folder.


SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key


SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

6. Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then Enter.

7. We can now enable the default-ssl configuration and restart Apache to load in our new configuration. We can do this with the following two commands.

sudo a2ensite default-ssl.conf
sudo service apache2 restart

8. You can test to make sure this is working by going to your Raspberry Pi’s IP address with https:// in front of it. It will give you a warning about it potentially being an invalid certificate. This is normal as it is an unsigned certificate.

For instance to make sure my own copy of Nextcloud is now running behind SSL I would go to the following.

Steps 9, 10, 11 and 12 are all optional and don’t need to be completed.

9. An optional extra step to ensure that you have the best security for your Nextcloud setup is to enforce SSL so no connection can be made over HTTP, if a connection is made it will redirect you to HTTPS.

We can do this by making some changes to our apache configuration, to begin let’s edit the default file with the following command:

sudo nano /etc/apache2/sites-available/000-default.conf

10. Replace all the text in this file with the code below. This will basically redirect all HTTP traffic to its HTTPs equivalent.

<VirtualHost *:80>
   ServerAdmin example@example

   RewriteEngine On
   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

11. Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then ENTER.

12. Now before this will work we need to enable the redirect module and restart apache. We can easily achieve this by running the following two commands:

sudo a2enmod rewrite
sudo service apache2 restart

Now going to your Raspberry Pi on HTTP should automatically redirect to the HTTPS version. For example, if I go to it will redirect to

Port Forwarding Nextcloud

Finally, onto the section about port forwarding Nextcloud. We won’t go into too much depth on the ins and outs of port forwarding for your router but we will tell you what ports need forwarding. We will also mention what changes need to be made to Nextcloud for this to work.

Before we get started with this section you need to know that Nextcloud will only operate under specifically specified trusted domains. Which means you will need to either specify a domain name that you want to use for your connection or use your public IP address.

Since most home public IP addresses are dynamic you will need to look into setting up a dynamic DNS service, you will find our tutorial on how to setup a dynamic DNS service for your Raspberry Pi very handy.

1. To add your domain/IP we need to modify NextCloud’s configuration file, we can do that by running the following command:

sudo nano /var/www/nextcloud/config/config.php

2. Within this file you will see a block of text like below. This is an array of all trusted domains that you allow Nextcloud to operate through.

For now, it should only include your Raspberry Pi’s local IP address. We will add our new domain/IP onto the end of this array.

'trusted_domains' =>
array (
    0 => '',

For our example, we will be adding to the array. This means we need to increment the array ID and add the domain name. Once you have added a new one it should look something like below. Repeat this procedure for any new IP’s or domains you want Nextcloud to be able to operate through.

'trusted_domains' =>
array (
    0 => '',
    1 => '',

3. Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then ENTER.

4. Finally you will need to port forward two ports to finally have Nextcloud up and running. These two ports being Port 80 and Port 443. The protocol required for these is TCP.

Hopefully by now you should have a fully operational Raspberry Pi Nextcloud Server.

If you come across any issues or have some feedback related to this tutorial, then please don’t hesitate to leave a comment below.

Leave a Reply

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


  1. Avatar for Mirko
    Mirko on

    Hello Gus,

    I used this guide to set-up a Nextcloud Server on an Odroid HC1 3 years ago. I’m now switching to a different system and wanted to check out the guide again to refresh my memory on how to install Nextcloud. I came on this webpage with the exception that this guide would have been long out dated but still giving general guidance about the different steps which one needs to perform. I never expected this guide to be continuously updated – thanks a lot for that

  2. Avatar for Mahesh
    Mahesh on

    Hello. great article that I have used to install my nextcloud server on my raspberry pi 400.
    I have gotten my own domain ( and want to create a subdomain like and access my nextcloud files via that as opposed to
    How can I do that?
    I believe it was this line in the nextcloud.conf that made that change [Alias /nextcloud “/var/www/nextcloud/”] but I cannot figure out how to modify it so that I can use “”
    Hope this makes sense and any help would be appreciated!

    1. Avatar for Emmet
      Emmet on

      Hi Mahesh,

      You can definitely do that, with the original version of the tutorial we had only assumed people would ever run it under “/nextcloud”.

      I have updated the guide to now also show you how you can set up the Apache configuration to run under a separate domain name.

      Please try refollowing the “Configuring Apache for Nextcloud” section but using the new Apache configuration shown there (Creates a VirtualHost rather than falling into the default one).


    2. Avatar for Mahesh
      Mahesh on

      Thanx Emmet!! This worked beautifully. I am all set.
      Much appreciated.

  3. Avatar for Felix
    Felix on

    Hi Emmet!

    I seem to have the same problem as Winfried. The PHP is not working, I just see a html file when accessing IP/nextcloud in the browser. I ran through the installation of php several times now and it is running. All other steps are done as well. Can’t find the problem.

    Thanks and all the best!

    1. Avatar for Emmet
      Emmet on

      Hi Felix,

      Can you please ensure that “libapache2-mod-php8.0” has been installed?

      sudo apt install libapache2-mod-php8.0


  4. Avatar for Davii
    Davii on

    Failed at step 3. Is there a reason you’ve updated the tutorial to use php8?! It’s not available in Buster. Raspbian Bullseye is less than 3 weeks old: so new, that the link you give to your own Raspbian versions page doesn’t even mention it yet. There’s no upgrade path from older versions, since apt full-upgrade is unsupported and specifically not recommended. Plus, there’s a lot of suggestion that Bullseye has been released too soon, and is not yet ready to be used as a production server.
    I, for one, shall be following the nice tutorial here:

    1. Avatar for Emmet
      Emmet on

      Hi Davii,

      There is a couple of reasons why I have changed this within the tutorial. Most new users will end up downloading and using Bullseye as that is what is being pushed through the official Raspberry Pi website.

      PHP 7.3 is no longer available in Bullseye and PHP 7.4 is not available in Buster. So I made the move to the recommended version of PHP from the Nextcloud team.

      What I should do is be offering an alternative pathway for installing / running PHP 8 on older versions of Raspberry Pi OS. I will work on including a guide that provides access to newer and older PHP builds. That way if I do make a change to the PHP versions, the tutorial should still remain functional for those wanting to stick with an older, perhaps more stable, version of Raspberry Pi OS.

      Also from my experiences making sure tutorials work on bullseye, I also must agree that it definitely needed more development time before being pushed as the new main version of Raspberry Pi OS.


  5. Avatar for Temelie
    Temelie on

    Thank you for your nice work. Very yousfoul

  6. Avatar for Steen Hansen
    Steen Hansen on

    Sorry, but this tutorial is updated very recently but still refers to Raspian Buster?
    Isn’t that a miss, as “they” have progressed to a newer version?

    1. Avatar for Emmet
      Emmet on

      Hi Steen,

      While the Raspberry Pi foundation have changed the name from “Raspbian” to “Raspberry Pi OS” it is still very much based off of the same build of Debian Buster. So the tutorial will continue to work fine!

      In this case the only difference is that the tutorial still refers to the older Raspbian branding. We do plan on slowly migrating our tutorials to reference the new branding.


  7. Avatar for pin
    pin on

    This no longer works perfectly as of this comment

    I have to install libapache2-mod-php for it to work fully

    1. Avatar for Emmet
      Emmet on

      Hi Pin,

      Thank you for pointing this out. I have now included this package as a part of the installation process.


  8. Avatar for Winfried
    Winfried on

    After installing nextcloud opening shows a page with code like below ( just a part of it) and no login page.
    Any idea what is wrong?
    I am installing nextcloud on a rapsberry 3 with raspbian buster.


    1. Avatar for Emmet
      Emmet on

      Hi Winfried,

      From the code that you showed that means that PHP is not currently running, and you are instead being served the files as if they were HTML.

      Make sure that you have followed the “Installing Apache and PHP” section.


  9. Avatar for Matha Goram
    Matha Goram on

    Excellent article!

    I’m one of those obsolete Western Digital Labs guinea pigs from years gone by when NextCloud launched their first RPi custom solution (now superseded). Your suggestions and recommendations are spot on. Thanks.

    Kind regards.

  10. Avatar for Ubuntu-user
    Ubuntu-user on

    Also worked flawlessly on Ubuntu 20.10 Server, although you’ll have change all php 7.3-packages to php 7.4

    1. Avatar for Ralph
      Ralph on


      Did you follow the same steps?
      I want to use an old laptop.


  11. Avatar for Curtis Tucker
    Curtis Tucker on

    I get the following warning in my nextcloud security scan:

    The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds.

    In the comments here there’s a post (from August 2017) that recommends editing /var/www/nextcloud/.htaccess

    However when I edit the file it “breaks” my nextcloud installation. When I restore the file to its previous state everything works as before.

    If anyone has other ideas on addressing the warning above I’d like to hear them. Thanks.

  12. Avatar for Jakub
    Jakub on

    Hey, I have trouble with downloading nextcloud server. I had entered the directory /vat/www/html and then tried to download nextcloud with this curl command. I’ve received text : “0bzip2: (stdin) is not a bzip2 file.
    tar: Child died with signal 13
    tar: Error is not recoverable: exiting now
    curl: (23) Failed writing body (4096 != 16384)”
    I have RPi 2B, 32GB card, newest Raspbian lite, updated before action.

    1. Avatar for Emmet
      Emmet on

      Hi Jakub,

      It appears as if you nextwork is dropping out while the Nextcloud file is downloading and you arent recieving the full file.


  13. Avatar for Fico
    Fico on

    Hey guys. I’m stuck super early trying to install PHP 7.3 and it keeps telling me that the packages couldn’t be located or found. I copied and pasted the code above and it is not working.

    1. Avatar for Emmet
      Emmet on

      Hi Fico,

      Are you running Raspbian Buster?

      If you are try running sudo apt update again before running the install command. The php7.3 packages should be available from the Raspbian Buster repository.


    2. Avatar for Matha Goram
      Matha Goram on

      On RPi3 Buster:

      sudo apt-get install php7.3 php7.3-gd sqlite php7.3-sqlite3 php7.3-curl php7.3-zip php7.3-xml php7.3-mbstring

      sudo apt install libapache2-mod-php7.3
      sudo apt install php7.3-gd php7.3-json php7.3-mysql php7.3-curl php7.3-intl php-imagick

    3. Avatar for Jaap
      Jaap on

      In step 3 of installing PHP it says to install “libapache2_mod_php”. But I assume this should be “libapache2-mod-php7.3”.
      Great tutorial, thank you!

    4. Avatar for Emmet
      Emmet on

      Hi Jaap,

      That would be correct. I definitely managed to mistype that completely.

      Thank you for pointing this out and I have corrected it in the tutorial!


  14. Avatar for agarwape
    agarwape on

    That was a great tutorial. Followed step-by-step and voila… Now I have a NextCloud storage server running on Raspberry Pi 3.
    Thanks for making it so easy.

  15. Avatar for Dirk Gaudian
    Dirk Gaudian on

    Wow – that was easy! Simply followed the tutorial step by step, switched on my brain when it came to let’s encrypt (I have a forwarded sub-domain on one of my play sites), tested, tweaked and it all works.
    Next I’ll swap the Pi 3B+ for a Pi 4 with 2 GB and once I have that running I’ll move the data folder to an external drive or maybe even to the NAS.
    I failed miserably on “NextCloudPi” earlier today, so this tutorial saved my day (night).

  16. Avatar for Nathan
    Nathan on

    First off I would like to say great article! One mistake I found along the way though was under where you change the max upload size. It says to use the command

    sudo nano /etc/php/7.0/apache2/php.ini

    when it appears it should be

    sudo nano /etc/php/7.3/apache2/php.ini

    Also I think it would be nice if under the part of the article about adding HTTPS if you were to add a link to your let’s encrypt article. Of course this is just optional, but it is a nice option.

    1. Avatar for Gus
      Gus on

      Hi Nathan,

      Thank you for picking up that mistake! We have fixed it now. (Missed it when we updated the tutorial for 7.3)

      Also, thank you for the suggestion about Let’s Encrypt! I have now added a link to the tutorial.


  17. Avatar for Paul Mitchell
    Paul Mitchell on


    I’ve followed the instruction to the letter but when I to to IP/nextcloud I get this long list of errors:


    Please ask your server administrator to restart the web server.

    I’ve reinstalled PHP several times and tried several comment suggestions but no luck! Running Buster if this is a problem?

    Thanks in advance for any guidance

    1. Avatar for Emmet
      Emmet on

      Hi Paul,

      Can you try running the following command. It looks like PHP 7.0 was removed in Raspbian Buster.

      sudo apt-get install php7.2 php7.2-gd sqlite php7.2-sqlite3 php7.2-curl php7.2-zip php7.2-xml php7.2-mbstring


    2. Avatar for Paul
      Paul on

      Thanks for the reply. After several times removing it and reinstalling it I managed to get it to work by using the more up to date nextcloud install, so all good now 🙂

    3. Avatar for Emmet
      Emmet on

      Hi Paul,

      Im glad you managed to get it to work in the end. We have updated our tutorial so it should work with Raspbian Buster a lot better now.


  18. Avatar for Martin
    Martin on

    An excellent guide! In the ‘Increasing Nextcloud’s max upload size’ part, I’d also suggest changing ‘upload_tmp_dir’ to somewhere you have enough free space, because it uses RAM by default. If you increase the max file size to let’s say 8GB, you’re gonna run into problems if you don’t change it.

    1. Avatar for paeore
      paeore on

      Would you still run into problems if the sd card is 32Gb capacity?

    2. Avatar for Emmet
      Emmet on

      Hi Paeore,

      If you have a ton of free memory on your SD card you should be fine not touching that option.

      By default it will use your systems default temp directory.


  19. Avatar for Pierce
    Pierce on

    Do I need to do the Port forwarding if I don’t need to access my Pi outside the network?

    1. Avatar for Gus
      Gus on

      Hi Pierce,

      No, you don’t need it. Port forwarding is only required if want access outside your local network.

  20. Avatar for symgym
    symgym on

    Awesome! Thanks. I installed NextCloud along side of Freedombox. Most of the apache configuration including LetsEncrypt carried over from the Freedombox installation.

    Really great, easy to follow and no missing step.