HTTP ERROR 500 when I access /mail

Hello,

I have updated mail-in-a-box to the latest v70, but each time I try to access the mailbox, I get HTTP ERROR 500.

The rest of the system appears ok and I don’t see any errors on the dashboard.

Any ideas where I can find the logs etc?

Thank you.

Hmm.

Do you mean webmail? If so discribe your system. Is IPv 6 also enabled?

You want to start with /var/log/nginx/error.log

  1. Yes, I meant the webmail, even after re-running the mailinabox upgrade
  2. Nothing in error.log, but access.log shows this x.x.x.x - - [12/Apr/2025:15:59:46 +0800] "GET /mail/ HTTP/2.0" 500 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"
  3. How do I tell if IPv6 is enabled or not?

What other details do you need? Because, I re-ran mailinabox upgrade for v71a

  1. Uncommented last 3 lines of /etc/php/8.0/fpm/pool.d/www.conf to enable logging
  2. Log file in /var/log/roundcubemail/errors.log
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 589
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 596
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 601
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 981
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 990
[12-Apr-2025 08:50:16 UTC] PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /usr/local/lib/roundcubemail/plugins/carddav/carddav.php on line 1124
[12-Apr-2025 08:50:16 UTC] PHP Fatal error:  Declaration of MStilkerich\CardDavAddressbook4Roundcube\RoundcubeLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\AbstractLogger::log($level, Stringable|string $message, array $context = []): void in /usr/local/lib/roundcubemail/plugins/carddav/src/RoundcubeLogger.php on line 99

Not really sure and this is 6 months old. Could be anything.

Why don’t you rsync the userdata to a safe location and do a clean install?
Take a note of any custom dns entries that you might have before you terminate the old instance. I assume the admin page works? Take a note of all users you will need to recreate in the new instance.

Reserve your public IP from the old instance. Allocate enough disk space on new instance (plan ahead) Do a clean install on a new instance. Ubuntu 22.04 x64 Assign the IP from the old instance. Recerate any custom dns entries and all the users.

Then restore with rsync.

rsync /home/user-data/

And do Copy this just in case:
/home/user-data/backup

  1. Restoring as per setup guide. Just in case. This is the duplicity backup (encrypted).There are 2 keys which you need to do a duplicity restore. You need root access to copy them or just cat them from terminal, If you wish to restore the backup as per the setup guide.

I think this would be easier than diagnosing the problem.

Thanks, 6 months ago was another server, this occurred again on a new server yesterday.

I actually never use roundcube, but since it fails to load, it becomes a concern as I’m wondering if anything else is broken.

Could you be more specific.
So, you are running a new instance. Not the one from 6 months ago and with a clean install, before you restore the backup you get the 500 error on roundcube?
Are you saying that the 500 error is reproduced with a fresh install?

https://box.yourdomain.com/mail

Are you running a vanilla Ubuntu 22? Is this an instance created with a VPS provider or you are running it from home? If you are running your own server from home change the ubuntu image or Ubuntu iso. This might cause the trouble. I see that you posted questions about docker containers? Are you running it from a docker?

I find it hard to believe that Roundcube would fail with a new vanilla Ubuntu. Are you suggesting that after restoring the users and the backup, Roundcube is failing?
Is nextcloud failing as well?
box.yourdomain.com/cloud

Is munin working

https://box.yourdomain.com/admin/munin/index.html

Is everything Green OK in the admin status page

https://box.yourdomain.com/admin#system_status

Are certificates provisioned?
https://box.yourdomain.com/admin#tls

  1. 6 months ago - server A
  2. Now - server B
  3. Not a fresh install, but I did just run sudo mailinabox which is supposed to restore everything to “work” condition
  4. Vanilla Ubuntu by VPS, it was installed about in Feb and everything worked
  5. No, not running from docker, see 3
  6. /nextcloud shows 404, unsure why, I never used it anyway
  7. munin works, but I don’t think anything under /admin it is based on PHP
  8. Everything is green on status page
  9. All certs provisioned, and cert issues will look very different, I’m able to troubleshoot that

Run sudo apt update sudo apt upgrade and reboot.

Rerun

curl -s https://mailinabox.email/setup.sh | sudo -E bash

See if it completes. See what messages you receive. Note what messages Nextcloud and Roundcube produce and report.

Thanks, but no errors and /mail remains 500

Updating system packages...
Installing system packages...
Initializing system random number generator...
Firewall is active and enabled on system startup
Synchronizing state of fail2ban.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable fail2ban
Installing nsd (DNS server)...
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
Installing Nextcloud (contacts/calendar)...
Nextcloud is already latest version
Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...
Installing Munin (system monitoring)...
updated DNS: OpenDKIM configuration

-----------------------------------------------

Your Mail-in-a-Box is running.

Please log in to the control panel for further instructions at:

https://.............

If you have a DNS problem put the box's IP address in the URL
(https://.............../admin) but then check the TLS fingerprint:

Try your IPv4 in a browser https://xxx.xx.xx.xxx/mail/

Advanced >> Proceed

If ipv6 is running try Ipv6 with brackets from an ipv6 configured browser.
Example https://[2001:470:1:18::115]/cloud

Hmm, let’s take a few steps back

  1. my https://my-hostname.com/admin works - yea?
  2. but https://my-hostname.com/mail HTTP 500
  3. What is the basis that a https://IP/mail will make 500 go away?

Trying to figure out if it is a DNS resolution issue or something else? Strange.

Well, 1 works, so it can’t be DNS.

Anyway HTTP 500 is quite telling, the issue is there are no logs anywhere on the server where I can find when using PHP 8.0, and nothing I change seems to log anything

Nginx logs are stored under /var/log/nginx and php logs under /var/log Are those not present?
Also, trying /mail and /cloud might help if it’s application specific or php specific. (assuming nginx works because /admin is ok)

/var/log/nginx shows 500 with no further details, no PHP logs anywhere that I could locate