How to properly configure Apache on Ubuntu 24.04 for Nextcloud 31.0.3.2?

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 32.0.3.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • 2.4.58
  • PHP version (e.g, 8.3):
    • 8.3
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • right at installation
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • from the downloaded .zip file
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • not that I know of: php -m doesn't list a "security" and I don't use Cloudflare

Summary of the issue you are facing:

I had Nextcloud installed in an OpenSUSE Tumbleweed machine. That quit working because Tumbleweed now is at php 8.4.5 and I get the error message “This version of Nextcloud is not compatible with PHP>=8.4.
You are currently running 8.4.5.”. That was sooner or later expected on Tumbleweed and to avoid future problems, I installed Nextcloud from scratch in a Ubuntu computer.

In that, when I try to access Nextcloud on localhost “https://localhost:(my non-standard-port)”, I get an “Internal server error”, without much information.

Apache error.log shows:

[Mon Apr 14 06:44:38.774438 2025] [mpm_event:notice] [pid 34752:tid 129442826684288] AH00489: Apache/2.4.58 (Ubuntu) OpenSSL/3
.0.13 configured – resuming normal operations
[Mon Apr 14 06:44:38.774480 2025] [core:notice] [pid 34752:tid 129442826684288] AH00094: Command line: ‘/usr/sbin/apache2’
[Mon Apr 14 07:58:17.993372 2025] [mpm_event:notice] [pid 34752:tid 129442826684288] AH00492: caught SIGWINCH, shutting down g
racefully
[Mon Apr 14 07:58:18.064264 2025] [mpm_event:notice] [pid 36596:tid 128455786190720] AH00489: Apache/2.4.58 (Ubuntu) OpenSSL/3
.0.13 configured – resuming normal operations
[Mon Apr 14 07:58:18.064308 2025] [core:notice] [pid 36596:tid 128455786190720] AH00094: Command line: ‘/usr/sbin/apache2’
[Mon Apr 14 08:41:51.753404 2025] [mpm_event:notice] [pid 36596:tid 128455786190720] AH00492: caught SIGWINCH, shutting down g
racefully
[Mon Apr 14 08:41:51.818763 2025] [mpm_event:notice] [pid 37917:tid 125123345696640] AH00489: Apache/2.4.58 (Ubuntu) OpenSSL/3
.0.13 configured – resuming normal operations
[Mon Apr 14 08:41:51.818800 2025] [core:notice] [pid 37917:tid 125123345696640] AH00094: Command line: ‘/usr/sbin/apache2’
[Mon Apr 14 09:37:53.294242 2025] [mpm_event:notice] [pid 37917:tid 125123345696640] AH00492: caught SIGWINCH, shutting down g
racefully
[Mon Apr 14 09:37:53.376160 2025] [mpm_event:notice] [pid 41019:tid 133570885142400] AH00489: Apache/2.4.58 (Ubuntu) OpenSSL/3
.0.13 configured – resuming normal operations
[Mon Apr 14 09:37:53.376208 2025] [core:notice] [pid 41019:tid 133570885142400] AH00094: Command line: ‘/usr/sbin/apache2’

that don’t look like errors to me, but I may be wrong.

Apache access.log is empty.

Apache /var/log/nexcloud_log has some errors related to a misconfiguration with the ciphers from a previous tr, nothing new.

apachectl status says:

Apache Server Status for localhost (via 127.0.0.1)

Server Version: Apache/2.4.58 (Ubuntu) OpenSSL/3.0.13
Server MPM: event
Server Built: 2025-04-03T14:36:49
__________________________________________________________________

Current Time: Monday, 14-Apr-2025 09:55:39 CEST
Restart Time: Monday, 14-Apr-2025 09:37:53 CEST
Parent Server Config. Generation: 1
Parent Server MPM Generation: 0
Server uptime: 17 minutes 45 seconds
Server load: 0.93 0.95 0.99
Total accesses: 0 - Total Traffic: 0 kB - Total Duration: 0
CPU Usage: u.01 s.01 cu0 cs.02 - .00376% CPU load
0 requests/sec - 0 B/second
1 requests currently being processed, 0 workers gracefully restarting,
49 idle workers

Slot PID Stopping Connections Threads Async connections
total accepting busy graceful idle writing keep-alive closing
2 41023 no 0 yes 1 0 49 0 0 0
Sum 1 0 0 1 0 49 0 0 0


W_________________________


Scoreboard Key:
“_” Waiting for Connection, “S” Starting up, “R” Reading Request,
“W” Sending Reply, “K” Keepalive (read), “D” DNS Lookup,
“C” Closing connection, “L” Logging, “G” Gracefully finishing,
“I” Idle cleanup of worker, “.” Open slot with no current process

occ status says:

  • installed: true
    • version: 31.0.3.2
    • versionstring: 31.0.3
    • edition:
    • maintenance: false
    • needsDbUpgrade: false
    • productname: Nextcloud
    • extendedSupport: false

I tried to follow the installation instruction on the Nextcloud Web site and tried to follow as much as possible of the Apache configuration from the Tumbleweed machine (obviously replacing the directories, and whatever else I saw that is different in Ubuntu).

My nextcloud.conf (apache virtual server file) looks like:

Protocols h2 h2c http/1.1

<VirtualHost *:(my non-standard port)>
DocumentRoot /var/www/nextcloud/
ServerName mydyndnsdomain.net #(not real, but there’s the real one here)

    <IfModule mod_headers.c>
            Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>

ErrorLog /var/log/apache2/nextcloud_log
CustomLog /var/log/apache2/nextcloud_access combined

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

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

SSLEngine on

SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1

SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW

SSLCertificateFile /etc/apache2/certificates/nextcloud.pem
SSLCertificateKeyFile /etc/apache2/certificates/nextcloudkey.pem
SSLCACertificateFile /etc/apache2/certificates/andreas-cacert.pem

I’m out of clue as to how to troubleshoot this further. I will be happy to provide other configuration files if needed.

Steps to replicate it (hint: details matter!):

  1. Configure Apache according to the instructions
  2. Install Nextcloud according to the installation instructions for installation from command line in Ubuntu.
  3. Restart the Apache server

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

(https://pastebin.com/vtSTHpDK)

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

PASTE

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "andreacroci.ddns.net"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "31.0.3.2",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false
    }
}

Apps

The output of occ app:list (if possible).

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

Your Nextcloud log suggests you missing the PHP mysql module.

But

  php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imagick
imap
intl
json
ldap
libsmbclient
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
random
readline
redis
Reflection
session
shmop
SimpleXML
smbclient
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Is there another PHP mysql module besides mysqli, mysqlnd and pdo_mysql? Or are the modules there, but not loaded?

Then again, the installer did create the database with (probably, as far as I can tell) all the needed tables just fine. I can log into mysql, see the nextcloud database and a lot of tables there.

With the help of ChatGPT and a lot of hours of work, I seem to have narrowed it down to an SSL problem due to a self-signed certificate I did for a dynDNS domain that I’m now using for a different one. The clients don’t seem to like that.

I’ll try to go that route and report back, but I’m 90% sure that that’s the culprit.

OK, so, sorry for that: let’s stick with the humans who are a lot more intelligent than the artificial intelligence. :smile:

I did some more testing and I think I can pretty much rule out the SSL idea. I added to my virtual host file another that listens on a non-SSL port and that doesn’t reply either (same message: internal server error).

On the other hand I ran sudo -u www-data php occ db:add-missing* and two of them reply done and the other one replies nothing. If the PHP mysql module had a problem or was not loaded, then those commands shouldn’t run at all, right?

I turned on debug level for the apache error logging and that obviously spits out an enormous amount of data I can make absolutely no sense of. If anyone wants to see that, please ask.

What else could I check?

Thanks Jtr, you nailed it.

The modules were indeed there, but they were not loaded. I loaded them and now it’s working.

Issue solved and closed.

1 Like

It seems that you are not aware that PHP consists of two different components, the CLI (command line) version, which you used to check the module availability, and the WEB version, which the module to be loaded too.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.