Nginx not starting after restore


#1

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!


#2

try renewing the certs and try again.


#3

there is a script in the tools dir.


#4

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


#5

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


#6

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


#7

delete ssl_certificate.pem and try again


#8

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 ?


#9

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


#10

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


#11

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


#12

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.


#13

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.


#14

wiki? Meaning this link, or someplace else?

https://mailinabox.email/maintenance.html


#15

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


closed #16

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