How to delete a domain name include the folders etc

  • Posted September 20, 2014

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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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`