How to Install and Configure Nextcloud Hub 21

This tutorial explains how to install and configure Nextcloud Hub version 21 on Ubuntu Server 20.04 LTS. I show how to configure Apache and how to set up a MySQL user and database for Nextcloud Hub. I also walk you through common security & setup warning issues that often come up when installing Nextcloud. Finally, I explain how to properly configure PHP, set up a cronjob, ONLYOFFICE, and SMTP.

Updates

  • Updated on 24th July 2021 to fix error: Memcache \OC\Memcache\APCu not available for local cache
  • Updated on 07th November 2021 to work with the latest Nextcloud and PHP versions

Install Apache & MySQL

Most likely, you already have Apache2 and MySQL installed on your server. If not, you can quickly install them with

sudo apt update
sudo apt install apache2
sudo apt install mysql-server

Before setting up a new user and database, you should secure your MySQL server (again, you can skip this step if you already have used MySQL before)

sudo mysql_secure_installation
VALIDATE PASSWORD COMPONENT: n
New root passwort: <YOUR MYSQL PASSWORD>
Re-enter new password: <YOUR MYSQL PASSWORD>
Remove anonymous user: y
Disallow root login remotely: y
Remove test database and access to it: y
Reload privileges tables now: y

Prepare MySQL database

In a next step, you want to create a new user and database on your MySQL server:

sudo mysql -u root -p
<ENTER YOUR MYSQL PASSWORD>
mysql> create database nextcloud;
mysql> create user 'nextcloud'@'localhost' identified by 'PASSWORD';
mysql> grant all privileges on nextcloud.* to 'nextcloud'@'localhost';
mysql> flush privileges;
mysql> quit

Install PHP for Nextcloud

For Nextcloud to work, you will need a new version of PHP as well as a few PHP libraries. Likely, you have already installed a version of PHP but its also no problem to have multiple versions installed on your server. We will talk about how to enable the latest installed PHP version in Apache in the section Configure Apache for Nextcloud below.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt upgrade

Install PHP with all required libraries:

sudo apt install php8.0
sudo apt install php8.0-gd php8.0-mysql php8.0-curl php8.0-mbstring php8.0-apcu
sudo apt install php8.0-intl php8.0-gmp php8.0-bcmath php8.0-xml
sudo apt install libapache2-mod-php8.0 php8.0-zip php-imagick redis-server php-redis

As of writing this article, Nextcloud does not work with PHP8.1 so make sure to use PHP8.0 instead!

Download Nextcloud Hub 21

  • Go to https://nextcloud.com
  • Click on “Get Nextcloud”
  • Click on “Server packages”
  • Right-click on “Download Nextcloud”
  • Click on “Copy link address”

Then, download the latest version of Nextcloud directly onto your home server:

wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.zip

Next, unzip Nextcloud directly into the www directory of Apache (first run sudo apt install unzip if you don’t have unzip installed yet):

sudo unzip nextcloud-23.0.0.zip -d /var/www

Switch directories and change ownership of the Nextcloud folder to Apache, which is the “www-data” user:

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

Configure Apache for Nextcloud

First, you need to enable a few Apache modifications for Nextcloud to properly run

sudo a2enmod headers env dir mime rewrite
sudo service apache2 restart

Add a VirtualHost entry in the default configuration file of Apache. If you already have a domain name, you can additionally specify it under the DocumentRoot directive. Don’t worry if you don’t have your own domain – you can just as easily use Nextcloud only locally without the need of a domain name.

<VirtualHost *:80>

    ServerName cloud.yourdomain.com
    DocumentRoot /var/www/nextcloud

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

        <IfModule mod_dav.c>
            Dav off
        </IfModule>

        RewriteEngine On
        RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/host-meta https://%{SERVER_NAME}/public.php?service=host-meta [QSA,L]
        RewriteRule ^/\.well-known/host-meta\.json https://%{SERVER_NAME}/public.php?service=host-meta-json [QSA,L]
        RewriteRule ^/\.well-known/webfinger https://%{SERVER_NAME}/public.php?service=webfinger [QSA,L]

    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Finally, restart Apache

sudo service apache2 restart

Optionally, you can also secure your Nextcloud installation using SSL. You can find a tutorial on how to enable SSL for your Nextcloud installation here.


Nextcloud Configuration

I generally recommend to set up a static local IP address for your home server, which you can do in your router’s configuration:

In my case, my Nextcloud server is located at 192.168.1.50, hence I need to update the Nextcloud configuration file in order to be able to use that local IP address to browse to my Nextcloud instance. Also, this is where you can specify your domain if you have one:

'trusted_domains' => 
array(
  0 => 192.168.1.50:80
  1 => http://yourdomain.com
),

You should now be able to access your Nextcloud instance by browsing to http://YOUR-SERVER-LOCAL-IP

Configure MySQL Database for Nextcloud Hub 21

Fixing Installation Issues

Click on settings and then on “Overview” to see on-going issues with your Nextcloud installation. It is completely normal for a new installation to produce a few errors, so here is how you can fix the most common issues

Update PHP Configuration

Any fresh Apache & PHP installation will trigger the following warning:

  • The PHP memory limit is below the recommended value of 512MB.

This can easily be fixed by increasing the respective value in the php.ini file:

memory_limit = 512M

Set up Cronjob for Nextcloud

For Nextcloud to run smoothly, you will want to set up a cronjob. This is a task that is executed automatically in the background. Modify your Apache cronjob:

sudo crontab -u www-data -e

If asked, press “1” to use the nano editor (which is super easy to use) and add the following line to your crontab file:

*/5  *  *  *  * php -f /var/www/nextcloud/cron.php

This will execute the Nextcloud cronjob every 5 Minutes. You can use this website to better understand how to modify the execution period: https://crontab.guru/every-5-minutes


No default phone region set

This error can simply be fixed by adding the following line to the Nextcloud config.php:

'default_phone_region' => 'GB',

No memory cache has been configured

It is highly recommended to set up some form of memory caching in order to improve your Nextcloud’s performance. I recommend using Redis for this purpose, which we have already previously installed during the PHP installation process.

First, check if Redis is actually running on your server. If you don’t get the output below, make sure to install ‘redis-server’ and ‘php-redis’

roman@tutserv:~$ ps ax | grep redis
2488834 ?        Ssl    1:24 /usr/bin/redis-server 127.0.0.1:6379

Add the Apache user (www-data) to the redis group and restart the web server

sudo usermod -a -G redis www-data
sudo service apache2 restart

Finally, simply add the following lines to your Nextcloud configuration

  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
  ),

Note: As of December 2021, using redis as file cache would crash your server with the infamous “Internal Server Error”. Thanks to sebastian for suggesting a fix for this issue!

This will enable file locking to avoid corrupting files and specifies Redis as local caching server. We need to explicitly state that we want to use the Redis server running on our localhost (127.0.0.1) and on the default port (6379).

Fix php-imagick warning

On a fresh installation of Ubuntu 20.04 you will likely get the following warning message:

  • Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.

Then you will have to first uninstall ImageMagick and all its dependencies using:

sudo apt remove imagemagick-6-common php-imagick
sudo apt autoremove

and then reinstall imagemagick;

sudo apt install imagemagick php-imagick

Install ONLYOFFICE

  • Click on your user image
  • Click on Apps
  • Select Office & Text from the left menu
  • Download and enable the Community Document Server
  • Download and enable ONLYOFFICE
  • Click on your user image and go to settings
  • Make sure to update your Document Editing Service address

Move Nextcloud data directory

You can move the Nextcloud home directory to any drive of your liking if you want to save files that your Nextcloud serves on another drive than your OS drive (which you probably want since you likely won’t have terrabytes of space on your OS drive):

First, make sure that the External storage support is enabled: https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html

WARNING: Make sure that the “data” folder in the target directory does not yet exists!

sudo cp -a /var/www/nextcloud/data/. /mnt/cloud/data/

Next, update the Nextcloud configuration to reflect the new data directory:

'datadirectory' => '/mnt/cloud/data',

Further Nextcloud Configuration

If Nextcloud is not installed in a subfolder, update the .htaccess file

sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess 

Set up SMTP

Attention: In order to set up SMTP and enable email notifications from Nextcloud you will need to have a valid SMTP server.

First, you will need to actually set an Email address for your Nextcloud user:

First, set up your Email under "Personal Info"

Next, enter your SMTP details under “Basic settings”:

Next, enter your Email's SMTP credentials under "Basic Settings"

Finally, if you are running a firewall (which you should!), you will need to allow two ports for SMTP to work:

sudo ufw allow 465

Congratulations, you should now have a working version of Nextcloud Hub version 21 up and running!


66 thoughts on “How to Install and Configure Nextcloud Hub 21”

  1. Hi Roman, thank for your Video with instructions how to install , I had problem running it on php7.4 , and not thinking correctly because icloud work on php8.0 as well.
    take care – Exodus

    Reply
  2. Hey Roman, great Guide. However, I can’t get the PHP Memory limit to go away. I’ve edited the php.ini file and it’s still showing after service restart and server reboot.

    Reply
  3. Hi Roman,
    Thanks for the great video!!
    I managed to handle all the errors except couple,
    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 “properties_pathonly_index” in table “oc_properties”.
    Missing index “job_lastcheck_reserved” in table “oc_jobs”.
    I tried to run sudo -u www-data php occ db:add-missing-indices but got this error
    “This version of Nextcloud is not compatible with > PHP 8.0.You are currently running 8.1.8.root@workspace:/var/www/nextcloud”

    The PHP module “imagick” is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.

    I tried uninstalling and installation.. but no luck. Any other suggestion?

    Also i couldnot get the cron to work. tried

    */5 * * * * php -f /var/www/nextcloud/cron.php

    and */5 * * * * php8.0 -f /var/www/nextcloud/cron.php as well. as per David’s comments

    I am running php version 8.0 and nextcloud version 23.0.8

    Any suggestion will be of great help!!!

    Reply
    • I think I found the issue. The redis setup wasn’t working for me so I tried this. Now the cron jobs working.

      ‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
      ‘memcache.local’ => ‘\OC\Memcache\Redis’,
      ‘memcache.locking’ => ‘\OC\Memcache\Redis’,
      ‘redis’ => array(
      ‘host’ => ‘localhost’,
      ‘port’ => 6379,
      ),

      Reply
  4. Dear Roman some Repositories updated to php8.1 If you want to update your Guide you would need to change
    the line:
    sudo apt install libapache2-mod-php8.0 php8.0-zip php-imagick redis-server php-redis
    to:
    sudo apt install libapache2-mod-php8.0 php8.0-zip php8.0-imagick redis-server php8.0-redis

    Kind Regards
    Tobias
    PS: Thank you for your Guide. While it wasn’t perfect it was the best start for my selfhosted Nextcloud without snap or docker dependency!

    Reply
    • Hi Tobias
      Thank you so much. Does PHP8 now work with NC? I tried running NC on PHP8 a few months ago but ran into multiple issues back then, which is why I didnt include them in the tutorial (I actually already changed them but due to my issues I rolled that version of the script back)
      Best
      Roman

      Reply
  5. 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 “properties_pathonly_index” in table “oc_properties”.
    Missing index “job_lastcheck_reserved” in table “oc_jobs”.
    Missing index “direct_edit_timestamp” in table “oc_direct_edit”.
    The PHP module “imagick” is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.

    NEED TO FIX THIS ASAP…!!! NEED HELP

    Reply
    • Execute the following commands:
      cd /var/www/nextcloud (or wherever you have installed nextcloud)
      sudo -u www-data php occ db:add-missing-indices

      Reply
  6. Hello i’ve problem installing apps because timeout, i’ve edit timeout into 1200 but its not work for me.

    i look a different way to install apss with occ, please make an article “how to enable occ on nextcloud”

    Thanks

    Reply
  7. Hi Roman,

    I am trying to look for config.php in this path (/var/www/nextcloud/config) but this file doesn’t exist. Any idea?

    Reply
    • I was able to create new config.php, however, now I am stuck at the step with error message :

      Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Permission denied.

      **I am sure I have insert the correct database username, pw and database name…

      Reply
  8. Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Permission denied
    when I try to create an admin user and connect to the database I got this message

    Reply
  9. Hello, I have installed nextcloud on the Ubuntu server for scientific purposes as an experiment to use this application, but I am facing a change in the main page of NextCloud in order to add some fields that must be filled in for the new user, so he wanted a video or a message containing pictures How to modify the home page so that I can benefit from In my needs with thanks and appreciation.

    Reply
  10. I’ve recently had to modify the cron job to specify php8.0

    */5 * * * * php8.0 -f /var/www/nextcloud/cron.php

    Reply
  11. hi, love your videos and instructions,
    followed everything up until sudo chown -R www-data:www-data nextcloud/
    however, when I do that I get an error: “chown: invalid user: ‘wwww-data:www-data’”

    running ” grep www-data /etc/passwd ”
    gets the following: “www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin”

    did a reboot as well, if you could guid me what I have done wrong along the way.

    Thank You

    Reply
  12. my nextcloud folder is locked it requires admin permision and the owner is www-data and i wanna uplad my photos from syncthing but it denies me how do i make it unlock for all

    Reply
  13. hey hi, thanks for this !!

    after editing the nexcloud config file (/var/www/nextcloud/config/config.php) with my local ip it doesnt worjk and shows ” Internal Server Error

    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the webserver log.”

    any idea ??

    this is the file below, i tried to leave what was inside before editing :


    ‘oc5xxxx9ly’,
    ‘trusted_domains’ =>
    array(
    0 => 192.168.1.61:80
    1 => http://yourdomain.com
    ),
    );

    Reply
    • sorry for the mess here, i cant paste the php tag thing here,
      so below is missing the beginning of php tag

      $CONFIG = array (
      ‘instanceid’ => ‘oc5jwxwxgm9ly’,
      ‘trusted_domains’ =>
      array(
      0 => 192.168.1.61:80
      1 => http://yourdomain.com
      ),
      );

      Reply
      • Hi! You formatted the trusted domains array wrong (note the commas and apostrophes, and don’t specify the port), should be

        ‘trusted_domains’ =>
        array (
        0 => ‘192.168.1.61’,
        1 => ‘http://yourdomain.com’,
        ),

        Reply
  14. I follow your install guide but I still have issues with:

    This instance is missing some recommended PHP modules. For improved performance and better compatibility, it is highly recommended to install them.
    Imagick

    I did remove it and install it again but it seems persist same issue

    Reply
  15. Hi, Great guide, i have only one problem.

    When i try to change the folder “Move Nextcloud data directory” i receive the error missing the .ocdata, but he file is in the folder.

    Receive the error
    Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.

    Reply
    • Also sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess this folder OCC no exist in my installation

      Reply
      • Sorry about OCC give me this error

        $ sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
        Your data directory is invalid
        Ensure there is a file called “.ocdata” in the root of the data directory.

        Cannot create “data” directory
        This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/23/go.php?to=admin-dir_permissions

        An unhandled exception has been thrown:
        Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:164
        Stack trace:
        #0 /var/www/nextcloud/console.php(98): OC\Console\Application->loadCommands()
        #1 /var/www/nextcloud/occ(11): require_once(‘…’)

        Reply
  16. Soo maybe its just me but every time I add redis for the cache it crashes my server along with any other caching method on nextclouds website any ideas???

    Reply
    • Hi Addison, you are not the only one… i am running into the same issue here. Also, “imagick” still reporting “missing”=> This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.

      Reply
    • same here,the only way i could make it work is using APCu for local caching :

      ‘filelocking.enabled’ => true,
      ‘memcache.local’ => ‘\\OC\\Memcache\\APCu’,
      ‘memcache.locking’ => ‘\\OC\\Memcache\\Redis’,
      ‘redis’ =>
      array (
      ‘host’ => ‘127.0.0.1’,
      ‘port’ => 6379,
      ),

      Reply
  17. Hi, Thank you for the tutorial. I still have some issues, somehow the cron job still not working as it should. A few moments later, the status went back to “Background jobs Last job execution ran… Something seems wrong” Under HTTP://localhost/cron.php..it shows “{“data”:{“message”:”Backgroundjobs are using system cron!”},”status”:”error”}” even after I run the command “sudo -u www-data /usr/bin/php -f /var/www/nextcloud/cron.php”. Any help appreciated!

    Reply
  18. Hi Roman
    Seems like your web-site is a little broken or may be I am perceiving it wrong but your table of contents container is not scrolling. I guess it was supposed to be static at top and when users scroll through the web-page the respective entries in the container will be highlighted but right now it is stuck in a weird part on the web page. Just wanted to make sure you notice that.

    Thanks for your videos and blogs. 🙂

    Reply
    • Thanks, the toc container is supposed to be stuck at the same position – it currently looks a bit strange because it is at the uppermost position when scrolled all the way to the top. I’ll check if I can implement it to be stuck at the top of the page as soon as the users scroll way from the top 🙂

      Reply
  19. I have followed your document. I am a new-B to Ubuntu and Nextcloud (apache, php, etc..). Things seem to work except the following errors.
    1) You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly. Please read the documentation page about this ↗.
    2) Accessing site insecurely via HTTP. You are strongly advised to set up your server to require HTTPS instead, as described in the security tips ↗.
    I have looked at the suggested documentation but being such a beginner I do not know what changes to make and where specifically to correct these items. Thanks for any help.

    Reply
  20. Hi,

    Thought I would discuss some errors I had so far and how I solved them. I am running Ubuntu server 20.04, Apache, MySQL, PHP7.4.3 and Nextcloud 22. I have direct contact with the server so I am not using SSH.

    1. When first connecting to Nextcloud through my web browser, I got a Nextcloud blue screen which said:

    “Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator at webmaster@{{domain}} to inform them of the time this error occurred, and the actions you performed just before this error.
    More information about this error may be available in the server error log.”

    …or something like that, didnt save it when I had the issue.
    What was special about this page was that on top of the page was the text that i had pasted into the Nextcloud config.php file at a previous step. The solution for me was to simply delete that config.php file. Then I got to the Nextcloud login/setup page.

    2. At the Nextcloud login/setup page, I set up the data folder to another drive’s partition mounted to /mnt/nextcloud/ or whatever.

    I got an error that said something like “Could not write to that location with user@mysqldb using password:No”
    …or something like that, didnt save this either.
    I solved it by
    1. Changed my www-user to my server username (my normal login name) in /etc/apache2/envvars. If you change this, remember to also chown -R nextcloud folder as in the guide. Don’t know if this is a good idea but it works for now.
    2. Automounted the drive in fstab, see Romans earlier guide
    3. Do not use the eye next to the password field when writing your pw, just paste/write and press the install Nextcloud button or whatever the button at the bottom says. When I used the eye to see if I wrote the right pw it did not work.

    3 days of error searching right there. I am at the step Redis now, might write more if it gets hairy. I have all the backups and stuff to setup still.
    I find it interesting that I experience all kinds of errors even though following the guide and have a fresh install of Ubuntu, I would think I had a clean starting point.

    Reply
    • I am experiencing the exact same issues and we are on similar time for install. Any luck getting up and running with no errors?

      Reply
      • Hi, I know this is a horribly late answer (over 2 years later), but what ended up happening for me was that I got Nextcloud up and running but had some issues which I can’t remember what they were anymore. Then during a brief moment of enlightenment I decided to update Ubuntu to the following version. Well it all went to shit of course so I gave up. I managed to save all my data so that was good.
        Now I am back at it, but this time I am going to run TrueNAS SCALE that has an official Nextcloud app. According to youtubers, the installation is easy and straightforward and it seems to work well without the hassle. It’s basically one-click deploy. This wasn’t available two years ago. I didn’t even know about TrueNAS two years ago, otherwise I wouldn’t have gone this route to begin with.
        And to answer JB here below, yes, I did completely delete the config.php file and it started working, this I remember because it was so strange to me.

        Reply
    • Hi, I am facing a similar issue as the one you described as #1. Did you completely delete the config.php file?
      Or did you remove the text portion you added from the tutorial?
      My is protected and can’t be removed. I left it empty but still have the issue.

      Reply
  21. Hi, followed your guide and got a nice working nextcloud environment.
    After that, I have moved the contents of data directory to another mount and got this error regarding occ file not available. Then I used the below command
    rsync -av . /mnt/ncdata

    By the way, with recent nextcloud update (v22), this works flawlessly.
    There is a file named “latest.zip” instead of “nextcloud*****.zip” which contains the latest stable release

    Also, I am getting error as cron job is not working properly. Any idea ??

    Reply
    • Good recommendation, rsync will definitely also work!

      Regarding the cron job error: This is because the latest NC version breaks compatibility with APCu. You can either install Redis and use that as cache or add the line ‘apc.enable_cli=1’ to /etc/php/7.4/mods-available/apcu.ini to fix this. I’m currently doing a video on just that 😉

      Reply
  22. Great tutorial! To make it a little bit spicier I would have paired this with Docker containers. Since I have been following your content at YT and for many services on the same server it would make things more stable and more fun 🙂
    By now it just crazy that I have 1Tb of own cloud storage on my raspberry Pi server

    Reply
  23. How do I “First, make sure that the External storage support is enabled!”? I did the steps for moving Nextcloud data directory but the files cannot be accessed by Nextcloud after that. The error message is that the files in Documents are missing.

    Reply
  24. Great guide but im stuck when i try completing the setup on the Nextcloud gui. This is the message:

    “Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘nextcloud’@’localhost’ (using password: YES)”

    Any ideas?

    Reply
    • Sounds like an issue with your mysql database. I would erase the old database and its user and do step “Prepare MySQL database” again. You’re running Ubuntu 20.04 though, right?

      Reply
      • I had the same issue. I resolved it by adding port 80 to local host in the setup page.

        localhost:80

        problem resolved. There is a note about using ports just below the database setup fields.

        Thanks for such a great tutorial. 🙂

        Reply
  25. Followed all steps and de-installed after the first time as I didn’t get into nextcloud than tried again and not getting into nextcloud but into php like the first install. So this is how it looks.

    <?php
    /**
    * @copyright Copyright (c) 2016, ownCloud, Inc.
    *
    * @author Christoph Wurst
    * @author Joas Schilling
    * @author Jörn Friedrich Dreyer
    * @author Lukas Reschke
    * @author Morris Jobke
    * @author Robin Appelman
    * @author Roeland Jago Douma
    * @author Sergio Bertolín
    * @author Thomas Müller
    * @author Vincent Petry

    Any suggestions?

    Reply
      • This happens when the web server does not parse PHP but rather just prints its contents. This really should not happen after going through the entire tutorial step by step…

        Reply
        • What will cause the php to not parse? I am having this issue and running in circles trying to fix it. I have repeated the guides steps multiple times in hopes to fix something and uninstall/reinstalled apache.

          Reply
  26. I am having some issues and was wondering if you could kindly help me with them as I am new to this.

    PHP configuration option output_buffering must be disabled
    Your data directory and files are probably accessible from the Internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the webserver document root.

    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 ↗.

    Your web server is not properly set up to resolve “/.well-known/webfinger”. Further information can be found in the documentation.
    Your web server is not properly set up to resolve “/.well-known/nodeinfo”. Further information can be found in the documentation.
    Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the documentation.
    Your web server is not properly set up to resolve “/.well-known/carddav”. Further information can be found in the documentation.

    Again i would like to thank you for all the work you have put into the tetoral and video.

    Reply
    • Sounds to me like an issue with the Apache reverse proxy – did you properly set up the rewrite rules like I have shown in this guide? That’s usually what trips up the “well-known” directories from my experience.

      Reply
      • I have the same issue, and no fix i found online works
        I followed your tutorial by the book. The only thing i did was to change the location where Nextcloud saves all the user data to a bigger drive, so it sits in a different folder. Maybe that has something to do with this because i now see there is a Data folder with users inside both in my original Nextcloud folder and in the newly created location

        Reply
  27. Thanks Roman and great stuffs.
    Managed to follow thru all the steps and it is very detailed.

    I have continued to apply ZeroSSL the existing certificate and pair keys to setup HTTPS using default-ssl.conf and it worked.

    The only last step when i tried to use both files 1) 000-default.conf and 2) default-ssl.conf for any access from http and https but it failed.

    I have referred your last year youtube video on how to configure SSL but it did not help.

    Any chance you can advise or refer me to any site. Thanks.

    Reply
  28. Followed it to the T

    get this

    Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘nextcloud’@’localhost’ (using password: YES)

    also Mysql is giving this

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysql> create database nextcloud1’ at line 1

    Any ideas im at a brick wall.

    Reply
  29. I have followed this guide up until the point when I enter my server’s IPv4 address (it’s a 10.0.0.XX) into my browser to see NextCloud for the first time. However, when I do this, I get nothing. “This site can’t be reached. Took too long.” I have no idea what to do. I followed the guides and the videos, but I’m still stuck. Any help?

    Also: When allow port 80/tcp on ufw and type in my server’s IP address, I get “Internal Server Error”. I also don’t see a config.php file in /var/www/nextcloud/config/. Just a config.sample.php file.

    Reply
    • You have to browse to the local IP address of your nextcloud server, so likely 198.168.0.X – up until this point you haven’t set up your server such that is reachable from outside of your local network (and that is good). You also don’t get a config.php because you have not finished the installation through the web GUI. BTW yes you will definitely need to allow connections through port 80 to your server!

      Reply
      • Is that the same IP address I use to SSH into my server? If so, where do I put it (which file do I have to edit)?

        Reply
        • Also, this guide lists that I need to edit the nextcloud config.php file (which doesn’t exist yet) before accessing the installation web GUI.

          But, I’d say “Internal Server Error” is better than “This site can’t be reached”, so Is there anything else I need to check in order to fix it?

          Reply
      • Hey Roman, I did some experimenting, and I had to delete a config.php file I accidentally created in the process. Other than that, the rest of the setup was simple and straightforward. Thanks for this written guide, really helped me out.

        Reply
  30. Hi, great guide but I’m having a weird issue. I installed nextcloud but when I go to edit the config file to set my static IP, there is no file in that location. I have tried several times to create a new instance of Nextcloud and every time I get the same issue.

    Any ideas?

    Thanks

    Reply

Leave a Comment

Dear reader

Ads allow me to dedicate a significant amount of time into the creation of valuable content both on YouTube as well as on this website.

Please support my work by disabling your ad blocker or whitelisting this site!

Alternatively, you can remove all ads on this site by becoming a supporter for as little as 2$/month. Thereby, you will directly support my content on YouTube and on this blog!