How to manually delete a site?

To manually delete the domain follow these steps. Everything needs to be done as root. REAL root. (”su -”).I have now made a script “mandel.sh” to do this in a simple way. You can download the script hereFirst make sure you unmount any mounted perl directory (see entry 4 in this FAQ)

umount /home/virtual/domain.com/usr/lib/perl5

and/or

umount /home/virtual/siteXX/fst/usr/lib/perl5

Check which siteX the site corresponds to: sitelookup -d domain.com site_handle and what adminX is responsible for it: sitelookup -d domain.com wp_user

rm -rf /home/virtual/siteX
rm -f /home/virtual/adminX
rm -f /home/virtual/domain.com
rm -f /etc/httpd/conf/virtual/siteX
rm -rf /etc/httpd/conf/siteX
rm -f /etc/webalizer/domain.com
userdel adminX

Remember to remove any other customization you have added

Now you need to clear out entries of the PostGreSQL database - replace the “X” with the X from siteX, i.e. if you’re removing site25 you need to change “X’ to 25 below:

psql appldb

Welcome to psql, the PostgreSQL interactive terminal.
Type: copyright for distribution terms h for help with SQL commands
? for help on internal slash commands g or terminate with semicolon to execute query
q to quit
appldb=> delete from users where site_id = X;
appldb=> delete from reseller where site_id = X;
DELETE 0
appldb=> delete from bandwidth_log where site_id = X;
DELETE 0
appldb=> delete from bandwidth_spans where site_id = X;
DELETE 0
appldb=> delete from bandwidth where site_id = X;
DELETE 0
appldb=> delete from siteinfo where site_id = X;
DELETE 0
appldb=> (type Ctrl-D to quit)

Finally, you need to go through all the files in /etc/virtualhosting/mappings and check if any of them refer to the site you’re deleting. You can use grep to quickly see if/which files might refer to the site to be deleted:

cd /etc/virtualhosting/mappings

grep -l siteX *

For each file you get listed here you need to edit it and delete all lines referring to either siteX or domain.com as per the site you’re deleting.

Now all that’s left to do is clean up the mess; Restart Apache and Webppliance and you should be ok:

service httpd restart

service webppliance restart

Tags: ,

Leave a Reply