• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Deleting domains does not remove vhost root

websavers

Regular Pleskian
Hey there,

I've noticed a problem that seems to be persistent across all of our Plesk 12.5 servers. I've tested and confirmed this on one in particular running 12.5.30 Update #40.

When deleting a client and domain (in particular via terminate in WHMCS), the client, domain, subscription and databases are removed from Plesk, however the vhost directory and system user remain on the server.

This means that if we attempt to recreate the domain, we get an error about the system user already existing. It also means that disk space isn't reclaimed when we remove a domain -- this is a bigger problem.

For example if the domain and subscription is mydomain.com, removing it from Plesk results in no trace of the domain existing in Plesk, and all associated databases are physically removed.

Yet if you go to /var/www/vhosts/mydomain.com you'll see the full vhost structure there with all normal directories. If wordpress was installed, the complete wordpress files are still there in httpdocs or whatever the domain's docroot was.

Is this by design? And if so, is there a function to 'audit' domains in Plesk with their vhost dirs so we can automatically have Plesk 'clean up' after itself and remove the files and folders of domains that no longer exist in the GUI?

-Jordan
 
Hi websavers,

did you know, that Plesk is shipped with an "Event Manager" at "Tools & Settings > Event Manager"?
You might be interested in the event-task "Domain deleted", which could be used to delete the complete depending vhost-structure(s) and which could be as well used to delete a domain-user and even the deletion of depending DBs and system-folders ( "/var/www/vhosts/system/domain(or/and-subdomain)" is possible. The possible commands after such an event takes places, are any desired command(s), that you wish to be triggered. :)

Consider to have a closer look at the Plesk documentation search, as for example

 
Hey UFHH01,

Yes I'm aware of the Event Manager and how to use it for these kinds of tasks.

But before we go about configuring such a thing on every single server, I think it's important to figure out why this is happening in the first place. Is this intended behaviour? And if so, why is it not made more clear in Plesk when deleting a subscription or domain?

In other words, either this is a bug or intended functionality that doesn't match with user expectations and thusly it should be made more clear what will happen when a domain or subscription is deleted.

Attached you will see the warning provided by Plesk. It states: "Do you really want to remove the subscription and all websites created under it?" which indicates clearly to me that it will be removing all data. Yet it does not.
 

Attachments

  • remove-notice.png
    remove-notice.png
    12.9 KB · Views: 6
Hi websavers,

I do believe, that this is rather a problem with the combined-usage of WHMCS, because I don't experience such issues on Ubuntu- and Debian- servers ( with Plesk 12.0-17.0.14 ), which I administrate/use and can be explained as well in cases, where the API doesn't receive a positive response due to apache2 and nginx restarts, during the deletion-process. You might consider to raise the depending - log - levels for Plesk and maybe WHMCS related configuration files, so you get a more verbose output, which should point to the issue directly. ;) The described issue is not at all expected and should be considered as a bug when you use WHMCS on the same server.
 
UFHH01,

If only that were true. I manually created a subscription in Plesk then deleted it. Same result -- entire vhost directory remains. This is on CentOS 6.7. No WHMCS interaction at all.
 
Same here.
I use Ubuntu 14.04, Plesk 12.5 with MU60. Vserver with ca. 25 domains.

I deleted ONE domian and the owner of this domain. In Plesk this domain has disappeared in owner, abonnements and domains.

I restarted the server and took a look with WinSCP.
The "deleted" vhost und in vhosts/system still remains.

I did plesk repair all -n and verbose and it found 2 errors in database (empty row) concerning to this "deleted" domain which i let repair.
But domain in still visible in vhosts with index.html and all the content of this web.

Can i delete the files via WinSCP or what else can i do?

Thank you very much!

Same result on another server.
I deleted one domain on antother vserver with ubuntu14.04 and Plesk 12.5 MU60
vhosts stills exists.
running plesk repair all -n

Checking the consistency of the Plesk database

Inconsistency in the table 'DomainServices' for the column dom_id:
No rows in the table 'domains' with id = 13 ....................... [WARNING]
To see more details, run the command in the verbose mode: plesk repair db -ver bose

Inconsistency in the table 'hosting' for the column dom_id: No rows
in the table 'domains' with id = 13 ............................... [WARNING]
To see more details, run the command in the verbose mode: plesk repair db -ver bose

Inconsistency in the table 'hosting' for the column certificate_id:
No rows in the table 'certificates' with id = 4 ................... [WARNING]
To see more details, run the command in the verbose mode: plesk repair db -ver bose

Inconsistency in the table 'SubscriptionOutgoingMessagesStats' for
the column subscriptionId: No rows in the table 'Subscriptions' with
id = 11 (21 broken references) .................................... [WARNING]
To see more details, run the command in the verbose mode: plesk repair db -ver bose


I ran verbose and let it repair and run plesk repair all- n again.
Result:
Checking system users
The system user 'drmueller247' is orphaned in Plesk ............... [WARNING]

Thats the system user of the "deleted" domain.
But i deleted the system user, abonnement and domain via Plesk before.
When i check with WINSCP the "deleted" vhost still exists....

What can i do?

Apart from that both servers are running fine.



 
Last edited:
Have the db inconsistencies been repaired? If so, proceed:

Run
# httpdmng --reconfigure-all

Then: If the web server configuration files in /var/www/vhosts/system/DOMAIN.TLD/conf still exist, you should not delete the /var/www/vhosts/DOMAIN.TLD directory. If the configuraton files do not exist, you can delete /var/www/vhosts/DOMAIN.TLD.

If the inconsistencies have not yet been repaired, first take care of that issue, then continue as described above.
 
Last edited:
Hallo Peter.

Yes, I repaired the DB issues with the help of verbose etc. but warningThe system user 'drmueller247' is orphaned in Plesk ............... [WARNING] remains.
Its the username of the domain i cant delete.

I`m a little afraid what httpdmng --reconfigure-all affects, i never used it before and everything else works fine.
Do you know if there any risk to destroy more than it heals using httpdmng --reconfigure-all ?
Will it change my customs settings for domains, subscrptions, service plans...

In the past i never had problems with deleting domains.
Last week i installed letsencrypt for all domains also to the one i cant delete.
Maybe letsenrypt has negative effects to the "delete process" in Plesk?

Thank you very much for help!
 
I can't tell what's going on with the system user. If the user does not exist any longer and is not referred to by other datasets in your database, you can remove that dataset from the database.

"httpdmng --reconfigure-all" takes the settings from the psa database and generates all web server configuration files from these settings. There should not be any issues with it. It will not change custom settings of anything. It will simply apply all settings from the database to configuration files. If this causes a problem, you really have severe problems on the server.

Let's Encrypt does not have an effect on a delete process in Plesk. What you should not do however, is to create or delete certificates while another certificate creation or update process is still ongoing, e.g. start one process from terminal A and start a second one from terminal B.
 
fwiw, in our case all domain-specific web server configs were already wiped out by Plesk upon deletion of the domain; it simply left the vhost folder / data behind. We were able to safely wipe out the folder without affecting anything else in the system.

In my last test of this, deleting the subscription in Plesk did remove the vhost folder. I'm not sure what causes this to happen in some instances and not others... maybe some kind of permission issue remnant on servers that were long ago upgraded through from Plesk 9 -> 10 -> 11.5 -> 12 -> 12.5. Or perhaps Plesk fixed the bug quietly in a recent update...?

I wrote the following shell script to check for discrepancies where vhost data exists and yet there's no matching domain in Plesk. For data security reasons, you have to manually opt to wipe out the data for each domain, so it's not entirely automated.

Code:
#!/bin/bash

VHOST_DIR=/var/www/vhosts/
SYSTEM_DIR=/var/www/vhosts/system/
DOMAINS=$(plesk bin domain -l)
DOMAIN_FOLDERS=$(ls /var/www/vhosts/system)


for FOLDER in $DOMAIN_FOLDERS
do
        if [[ ! $DOMAINS == *"$FOLDER"* ]]; then
                if [[ -d "$VHOST_DIR$FOLDER" ]]; then
                        DISK=$(du -skh $VHOST_DIR$FOLDER | awk '{print $1}')
                        echo "$FOLDER is a domain that doesn't exist in Plesk using $DISK. Do you wish to delete these files?"
                        PS3='Delete?'
                        select yn in "Yes" "No"; do
                                case $yn in
                                        Yes )
                                                echo "-Deleting $VHOST_DIR$FOLDER"
                                                rm -r $VHOST_DIR$FOLDER
                                                sleep 5
                                                echo "-Deleting $SYSTEM_DIR$FOLDER"
                                                rm -r $SYSTEM_DIR$FOLDER

                                                echo "-Files Deleted"
                                                break;;
                                        No )
                                                echo Skipping...
                                                break;;
                                esac
                        done
                fi
                echo
        fi

done
 
Last edited:
Note that this is most definitely still an issue. I have to periodically run that script above to ensure we actually reclaim space from removed domains because Plesk refuses to do it for us. Can this please be looked into in more detail?
 
Back
Top