How to delete a domain name include the folders etc

September 20, 2014 2.8k views

How can I delete a website include the folder etc?
I use ubuntu and I have a few domain names on my server.

But how can I delete a "website" from my server?

1 Answer

First, you should delete the corresponding DNS records so that it's no longer pointing to your droplet. Once you've done that, you can delete the virtualhost configuration file which is usually in /etc/apache2/sites-enabled or /etc/nginx/sites-enabled.

You can then delete the website's files by running (replace /var/www/website with the actual path to your website's files):

rm -r /var/www/website

If you have a MySQL database, you'll probably want to delete it too:

mysql -u mysql_username -p

Enter your MySQL user's password and you should be logged in to a MySQL prompt (mysql>). Run the following command to delete the website's database:

DROP DATABASE `database_name`
  • My solution:

    1. Delete DNS records
    2. check host file: sudo nano /etc/apache2/sites-available/
    3. sudo rm /etc/apache2/sites-available/
    4. rm -r /var/www/
Have another answer? Share your knowledge.