Question

How to delete a domain name include the folders etc

Posted September 20, 2014 5k 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?

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.

×
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/websitename.com.conf
    3. sudo rm /etc/apache2/sites-available/websitename.com.conf
    4. rm -r /var/www/websitename.com
Submit an Answer