Deleting & Recreating a Virtual Server with same Admin name & Domain leads to socket connection failure

Deleting & Recreating a Virtual Server with same Admin name & Domain leads to socket connection failure.

Steps to Recreate :

  1. Create a Virtual Server - example.net and manually enter any admin name (say exadmin)
  2. Create 1-2 email users
  3. Delete Virtual Server
  4. Create the Virtual Sever with the same info as in step 1. (All info must be same)
  5. Reboot

Issue :

1 .FastCGI socket will be broken and site will not server PHP on reboot.

Additional Bugs on Delete :

  1. Mailbox folders remain the same and not reset
  2. Dovecot Fails to start because SSL reference does not get removed

Cause of Bug :

File : php-fcgi-example-net does NOT get updated with the new admin name and socket number

Workaround :

Manually edit the file with new socket number.

Status: 
Active

Comments

It looks like the real issue is that the PHP FPM config wasn't properly removed when the domain was deleted.

Does this only happen when you reboot the system?

The problem occurs even before the reboot since the file link is broken but

While the System is on, you can always go to : Virtualmin > Server Configuration > Website Options & change the PHP script execution mode (just click on any of the options)

While the above works till you reboot, you need to do it every-time you reboot until you manually change the php-fcgi-example-net file.

There is another problem I noticed. On Deleting and then adding the same user, his mailbox folders remain the same (even though the mailbox directory is completely deleted) To further elaborate, if you delete your Archive Folder, it will not be created again when you create the user. Still trying to find the work-around it.

Another Problem on Deleting Domains : Dovecot reference to SSL certificates do not get removed and DoveCot fails to start (until config file it edited to remove those refrences)

The Dovecot issue is a known bug that will be fixed in the next release.

For the original issue, it looks like the init script which starts the FPM server php-fcgi-example-net isn't being removed when switching away from FPM mode.

Also, did you get a chance to check user mailbox preferences ? For some reason if I delete a mailbox (eg. Archive) and then delete a user, and then recreate the same user, the new mailbox automatically has archive folder deleted.

The file php-fcgi-example-net should be deleted along with deleting the server right ?

Also, I believe another file "[SomeLongNumber].conf" under /etc/php/7.2/fpm/pool.d/ should also get updated. After deleting the Virtual Sever, the username of the deleted server still remains in the file and the php-fpm has trouble upgrading because of that.