Replace $mysite by the subdomain of the site you want to remove and $user by the associated username

  1. You may want to archive the website first
  2. Edit the DNS:
    • Don't delete the DNS if the website has been archived :)
    • Delete the records associated with the domain (don't forget www.)
  3. Database stuff:
    • `# mysql
    • > DROP DATABASE $dbname;
    • > REVOKE ALL PRIVILEGES, GRANT OPTION FROM '$user'@'localhost';
    • > DROP USER '$user'@'localhost';
  4. Letsencrypt:
    • # vim /etc/dehydrated/domains.txt
    • → remove the occurences of $mysite.squat.net and www.$mysite.squat.net
  5. Apache config:
    • # vim /etc/apache2/sites-enabled/wordpress.conf → Remove the line that matches $mysite.squat.net
    • # vim /etc/apache2/sites-enabled/redirects.conf → Remove the line(s) that match $mysite.squat.net
    • # systemctl reload apache2
  6. Remove symlink and folders:
    • # rm -i /usr/share/wordpress/wp-content/uploads/$mysite
    • # rm -rf /var/www/$mysite.squat.net
    • # rm /etc/wordpress/config-$mysite.squat.net.php
  7. Delete the user associated with the website:
    • First check if there are still files owned by the user: find / -user $user 2>/dev/null
      • If there are results, fix it or talk about with other members
    • Remove the user and its home directory: # deluser --remove-home $user
  8. Add a line in /root/Changelog