Deleted Site caused Webmin & Dovecot to fail, are old ssl references the culprit?

First of all I think I fixed this issue. I am putting this here in case anyone has similar issues or can offer a solution better than mine, and also so I can reference this, in case it happens to me again :slight_smile:

The trouble came when I deleted an expired site. I clicked ‘Delete Virtual Server’ with no issues. However, next time I added a new site, the webmin failed, I couldn’t access the control panel pages. I went to the terminal:

sudo virtualmin check-config
ERROR: Apache configuration errors were found :
AH00112: Warning: DocumentRoot [/home/example/public_html] does not exist
AH00526: Syntax error on line 27 of /etc/apache2/sites-enabled/example.com.conf:
Wrapper /home/example/fcgi-bin/php7.2.fcgi cannot be accessed: (2)No such file or dir

so I removed it from apache2:

sudo a2dissite example.com
sudo systemctl reload apache2

Still no dice:

sudo service webmin restart
Job for webmin.service failed because the control process exited with error code.
See "systemctl status webmin.service" and "journalctl -xe" for details.

I tried both “systemctl status webmin.service” and “journalctl -xe” - unfortunately, the info displayed was either too little (former), or too much (latter). Figuring it had something to do with the ssl, I found this post: https://stackoverflow.com/questions/51578269/cant-restart-webmin-status-2

By starting webmin with sudo /etc/webmin/start, it became more clear:

Starting Webmin server in /usr/share/webmin
Failed to open SSL key /home/example/ssl.key at /usr/share/webmin/miniserv.pl line 4432.

again the ssl was culprit, so I commented out references to example.com line 4432. Restarted again with sudo /etc/webmin/start, and it launched webmin! Everything was good until I noticed that I Dovecot was not working. No matter how many times I pressed the green arrow, it didn’t start. So back to the terminal:

sudo systemctl restart  dovecot
sudo systemctl status dovecot
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2020-06-21 23:14:05 UTC; 2s ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 26992 ExecStop=/usr/bin/doveadm stop (code=exited, status=75)
  Process: 29964 ExecStart=/usr/sbin/dovecot -F (code=exited, status=89)
 Main PID: 29964 (code=exited, status=89)

Jun 21 23:14:05 : Started Dovecot IMAP/POP3 email server.
Jun 21 23:14:05 : doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 188: ssl_cert: Can't open file /home/example
Jun 21 23:14:05 : dovecot.service: Main process exited, code=exited, status=89/n/a
Jun 21 23:14:05 : dovecot.service: Failed with result 'exit-code'.
lines 1-13/13 (END)

I commented out all entries for ‘example.com’ in /etc/dovecot/dovecot.conf, restarted dovecot, and all was well in the world of webwin again.

After all this, I wonder what I did wrong here? Is this a bug that deleting a website that it doesn’t also delete the ssl references? Or is it a user fault - did I neglect to do something correct before I clicked ‘Delete Virtual Server’?

I commented out all entries for ‘example.com’ in /etc/dovecot/dovecot.conf, restarted dovecot, and all was well in the world of webwin again.

After all this, I wonder what I did wrong here? Is this a bug that deleting a website that it doesn’t also delete the ssl references? Or is it a user fault - did I neglect to do something correct before I clicked ‘Delete Virtual Server’?