Apache2 refuses to work

I know the apache2 config is correct but every time I try to restart it it fails and the error log says

[ssl:emerg] [pid 42509:tid 139869208041344] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed

I did update to 22.04 (I know, not supported, It was an accident) but this is the only error I get and everything was working prior to this.

Nextcloud version (eg, 20.0.5): 22(?)
Operating system and version (eg, Ubuntu 20.04): ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 7.4(?)

The issue you are facing:

Is this the first time you’ve seen this error? Y

Steps to replicate it:

update to Ubuntu 22.04 from 20.04 with next cloud installed with the script(mabye)

The output of your Nextcloud log in Admin > Logging:

WEB INTERFACE NOT WORKING

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '161.97.82.210',
    2 => '---',
    3 => '---',
  ),
  'config_is_read_only' => false,
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '25.0.5.0',
  'overwrite.cli.url' => 'https://---/',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '5432',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncadmin',
  'dbpassword' => '---',
  'installed' => true,
  'instanceid' => '---',
  'upgrade.disable-web' => 'true',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'allow_local_remote_servers' => true,
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '1800',
  'log_rotate_size' => '10485760',
  'trashbin_retention_obligation' => 'auto, 180',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => false,
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => '',
  ),
  'logtimezone' => 'Europe/Berlin',
  'htaccess.RewriteBase' => '/',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\MarkDown',
    5 => 'OC\\Preview\\MP3',
    6 => 'OC\\Preview\\TXT',
    7 => 'OC\\Preview\\Movie',
    8 => 'OC\\Preview\\Photoshop',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\TIFF',
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => true,
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => '---',
  'mail_smtphost' => '---',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '---',
  'mail_smtppassword' => '---',
  'mail_smtpsecure' => 'tls',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'default_phone_region' => 'us',
  'updater.release.channel' => 'beta',
  'app_install_overwrite' => 
  array (
    0 => 'documentserver_community',
    1 => 'richdocuments',
  ),
);

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

[Fri Mar 24 20:00:40.947874 2023] [ssl:emerg] [pid 25021:tid 139971992258432] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:02:54.540976 2023] [ssl:emerg] [pid 25145:tid 140029590808448] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:03:01.596180 2023] [ssl:emerg] [pid 25199:tid 139628294530944] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:07:59.745695 2023] [ssl:emerg] [pid 33394:tid 139661930493824] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:08:05.152411 2023] [ssl:emerg] [pid 33653:tid 139728506062720] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:15:45.294683 2023] [ssl:emerg] [pid 40072:tid 139795886569344] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:16:54.419652 2023] [ssl:emerg] [pid 40228:tid 139661181519744] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:17:40.563121 2023] [ssl:emerg] [pid 42509:tid 139869208041344] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:17:49.064381 2023] [ssl:emerg] [pid 44765] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:17:57.913848 2023] [ssl:emerg] [pid 44799] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:19:54.571970 2023] [ssl:emerg] [pid 45667] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed
[Fri Mar 24 20:22:00.873533 2023] [ssl:emerg] [pid 46820] AH02311: Fatal error initialising mod_ssl, exiting. See /error.log for more information
AH00016: Configuration Failed

That looks like a problem with your certifcates.

Are your certificates still on the same location as before the update?

Look into your
/etc/apache2/sites-enabled/000-default-*-ssl.conf
(name of conf file may differ for you) for these lines:

SSLCertificateFile /path/to/your/fullchain.pem
SSLCertificateKeyFile /path/to/your/privkey.pem

(name of cert and key may differ for you)

Now enter in a terminal this command and look if it is without an error:

:~# openssl x509 -in /path/to/your/fullchain.pem -text
1 Like

It’s the mod_ssl config it doesn’t like. I believe by default some of that module’s config is in a different file included by the main Apache config. Maybe it got updated during your upgrade. It’s also modified/overridden by certbot in some installations.

You can run an Apache config check with apachectl. It may report something more helpful.

Did you read the separate Apache error log it mentions?

I just renewed my certs. Sorry but I doubt that’s it because It’s lets encrypt.

I see this error(interesting)

[Fri Mar 24 20:17:49.064239 2023] [ssl:emerg] [pid 44765] AH02407: "SSLOpenSSLConfCmd DHParameters /etc/letsencrypt/live/---/dhparam.pem" failed for ---:443

Why do you have doubts about my advice?
AH02311 indicates a certificate error.

quod erat demonstrandum!

Because I just renewed the certs from certbot and they still did not work. I’ll try it just in case but I don’t thing that is the problem.

OK well I just did it and it worked without error

OK so now it’s working BUT I don’t see the login page. I see this in a browser

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 server log.

I have literally no clue what I did but it is now fixed