My attempts to install NC fail continuously

Dear community,
Please guide me in making my attempts to install succeed. I have tried numerous times to install NextCloud and every time my installations end with Internal Server Error.

I am installing on Ubuntu 18.04.06, my PHP is 7.4, MySQL 5.7.37, Apache 2.4.29.

I have disabled default Apache configuration and have only nextcloud.conf enabled.

I have the following PHP mods enabled:

bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets

sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

The following Apache2 mods were enabled: rewrite, headers, env, dir, mime.
This is my nextcloud.conf

<VirtualHost *:80>
       

        ServerAdmin webmaster@localhost
        DocumentRoot "/var/www/nextcloud"
        <Directory "/var/www/nextcloud/">
        Options FollowSymLinks MultiViews
        AllowOverride All
        #Require all granted
        Order allow,deny
        Allow from all

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

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

</VirtualHost>

The errors that I can see in /var/www/nextcloud/data/nextcloud.log and which I can’t decode are in the linked file. I could not paste it here as I went above the max allowed number of characters in the post body.
NextCloud Log File

Please help me understand what I am doing wrong.

Thank you in advance

Hi @Walter

Did you check the the official docs? It does list all the needed PHP modules and also shows an example Apache configuration:

https://docs.nextcloud.com/server/latest/admin_manual/installation/example_ubuntu.html

https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#apache-configuration-label

Or here is more concidesed guide on how to install Nextcloud on Ubuntu incl. a good video tutorial:

https://www.learnlinux.tv/nextcloud-complete-setup-guide/

Also a very good guide, but more advanced:

Why do you use PHP 7.4 on Ubuntu 18.04 LTS. That is a very bad combination.

MySQL 8.0+ or MariaDB 10.2/10.3/10.4/10.5 (recommended)
System requirements

Can you install MariaDB or better Ubuntu 20.04 LTS and the actual PHP 7.3 and MariaDB version from Ubuntu 20.04 LTS?

On Ubuntu 18.04 LTS if you really need it:
Ubuntu – Informationen über Paket mariadb-server in bionic

Please change to Ubuntu 20.04 LTS.
In further Nextcloud releases perhaps Nextcloud 24 you need Ubuntu 20.04 LTS.

Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size

https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html

And yes. Use Ubuntu 20.04 with MariaDB if possible.

I got it, I sinned with the wrong OS environment. Let me try with 20.04 ASAP and update the topic.

Thank you @bb77

Thank you @bb77 and @devnull

So far I have been able to make Nextcloud work in a VM where I use standard PHP mod by adding the sort_buffer_size = 256000000string to the mysqld.cnf file and restarting the database service. After that I was able to access the dashboard and things seem to be working more or less stable. All this worked without installing on a new instance of Ubuntu 20.x, I am still on 18.04.06 with PHP7.4.

I have another VM where I am experimenting with another instance of NC deployed in PHP7.4-FPM mode and here the things look differently - very unstable and dashboard constantly falls off to 503 Service Unavailable error page.

Both NC instances have FQDNs and the VMs are behind HAProxy running on pfSense. The only difference is the PHP implementation used in the virtual machines.

If you can suggest any tweaks that can stabilize PHP-FPM instance please share with me.

Thanks