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: 
Fixed (pending)

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.

Just an update .....After deleting the server, the file still persists in the current version also.

Can confirm deleting and re-adding a domain is still an issue, the aforementioned php-fcgi-example-com file is located in /etc/init.d/php-fcgi-example-com for anyone who comes across this via search like me and had issues finding it.

Also to help bring relevant google searches to this page there are the errors I would come across in my log before switching PHP Execution Modes from FPM to FCGId in 'Website Options' under affected Virtualmin Virtual Server

connect() to unix:/var/php-nginx/15851138403793.sock/socket failed (2: No such file or directory) while connecting to upstream, client: xx.xx.xx.xx, server: example.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/15851138403793.sock/socket:", host: "example.com"

Ilia's picture
Submitted by Ilia on Thu, 11/19/2020 - 17:21

connect() to unix:/var/php-nginx/15851138403793.sock/socket failed (2: No such file or directory) while connecting to upstream, client: xx.xx.xx.xx, server: example.com,

What Webmin and Virtualmin versions this error happens on? What virtualmin-nginx module version do you have installed?

We don't listen on sockets by default. Did you re-configured anything manually? Did you try re-running config check?

Ilia's picture
Submitted by Ilia on Sat, 12/05/2020 - 04:55

We have released Virtualmin-Nginx module version 2.18, which should fix this issue!