Fix Laravel Forge Site Creation Problems

I just had a problem with this site. I use Laravel Forge to manage multipe VPS. Most of these VPS host multiple WordPress websites (using isolation). And I just want to delete one of these sites and create the same site again. That didn’t work. The site creation failed after deleting the site with the same name. Forge proposed me, I should check the SSH keys – they were fine. All the other sites at the same server were working without problems and the connection between Forge and the server was ok.

After some research, I discovered, that the old user still exists. This user is used for website isolation. So I tried to delete this user by running (replace MY_USERNAME):

sudo deluser --remove-home MY_USERNAME 

That didn’t work, because there was a process with PID 1234 running by this user. To check the corresponding process, run:

ps -p 1234 -o comm=

The result was php-fpm running in this user context. kill 1234 does not work, because the process is restarted immediately. That’s why I had to stop php-fpm:

sudo service php7.4-fpm stop

After the service has been stopped, the user could be deleted running the first command again:

sudo deluser --remove-home MY_USERNAME 

Now, the user was gone. After that, I restarted the server and now I was able to create the new site with the same name as the old site.

Maybe someone has the same problem and this solution might help…