Nginx not starting after restore

Hi everyone,
First, thanks for this great software. It really simplifies daily life.
So I followed the instructions to move my box from one server to the other.
Origin server: Ubuntu 18.04 up-to-date Mailinabox v0.40 working
Target server: Ubuntu 18.04 up-to-date mailinabox v0.40.
I followed the instructions on the wiki, and when I run sudo mailinabox after restoring files, nginx doesn’t start.
Here is the output of nginx -t:

nginx: [emerg] SSL_CTX_use_PrivateKey_file("/home/user-data/ssl/ssl_private_key.pem") failed (SSL: error:0B080074:x509
certificate routines:X509_check_private_key:key values mismatch)
nginx: configuration file /etc/nginx/nginx.conf test failed

And sudo management/status_checks.py:

✖  HTTP Web (nginx) is not running (port 80).
   nginx: [emerg] SSL_CTX_use_PrivateKey_file("/home/user-data/ssl/ssl_private_key.pem") failed (SSL:
   error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
   nginx: configuration file /etc/nginx/nginx.conf test failed
✖  HTTPS Web (nginx) is not running (port 443).
   nginx: [emerg] SSL_CTX_use_PrivateKey_file("/home/user-data/ssl/ssl_private_key.pem") failed (SSL:
   error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
   nginx: configuration file /etc/nginx/nginx.conf test failed

As expected, the webserver isn’t running. I probably messed up some SSL certificates.
Thanks in advance for your help!

1 Like

try renewing the certs and try again.

there is a script in the tools dir.

I’ll guess and say you are talking about management/ssl_certificates.py ?

1 Like

yes sorry im mobile at the moment so typing is tough!

Here is what I get: OSError: [Errno 40] Too many levels of symbolic links: '/home/user-data/ssl/ssl_certificate.pem'

delete ssl_certificate.pem and try again

Don’t worry, I’ll manage somehow.
Deleted, and now it is not found: FileNotFoundError: [Errno 2] No such file or directory: '/home/user-data/ssl/ssl_certificate.pem'
Should I re-run sudo miab ?

No … remove the contents of the /home/user-data/ssl/ directory
THEN
sudo mailinabox

1 Like

the setup might attempt to reinstall, yea I’d give it a go.

Yes it worked! Removing /home/user-data/ssl/* and then sudo mailinabox. Thanks a lot guys!

2 Likes

I am trying to figure out why this happened for you … you were moving servers from a working v 0.40 install to another v 0.40 install, correct? I assume that you copied the encrypted backups and restored using Duplicity rather than another method.

Yes. I followed the exact steps described in the wiki. Used scp to transfer the files. To be noted: the folder /home/user-data already existed on the new server prior to any steps taken to install MIAB. This was due to the fact that it is a mounted directory on another disk so I can increase the size of it whenever I want/need to. During the first installation there was a message like /home/user-data already exists. Not copying skel files. I assumed the install would create the skeleton files anyway.

wiki? Meaning this link, or someplace else?

Yes, this link: https://mailinabox.email/maintenance.html#moving-boxes

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