Broken nginx and dovecot

My virtual machine has physically moved to another server a week ago.
Everything was fine, but today expired ssl certificate. Trying renew I’v broke nginx and dovecot. I need to decide what to do: trying repair nginx and dovecot or install new server. I’m not so good in linux. Previous MIAB server I installed using step-by-step manual.

I’ve fixed dovecote and postfix after all with ssl. Mail is working now. But I can’t fix nginx yet. I reinstalled it. But when I try to configure nginx.conf it fails to start.

Try running

sudo mailinabox

It should reinstall everything.

If it doesn’t run after that, you’ll need to do some serious troubleshooting.

This will not affect the mailbox database and server settings?

No, it should not affect the settings, unless you’ve made unsupported changes to the system.

Could not get lock /var/lib/apt/lists/lock. It is held by process 143013 (apt -get)
What does it mean? I need to kill process 143013?

Just kill the process.
do
sudo apt update sudo apt upgrade
and reboot
and
sudo mailinabox