DirectAdmin How to Manually Remove a Domain

This guide provides step-by-step instructions for manually removing a domain from DirectAdmin control panel when the standard removal methods are unavailable or not functioning properly. Manual domain removal involves accessing DirectAdmin's configuration files and database to completely eliminate all domain-related entries and data.

1. Prerequisites and Warnings 2. Backup Important Data 3. Stop Related Services 4. Remove Domain Files 5. Clean Database Entries 6. Update Configuration Files 7. Restart Services 8. Verification Steps 9. Troubleshooting 10. Alternative Methods

Prerequisites and Warnings

Before proceeding with manual domain removal, ensure you have root or admin access to the server and understand the risks involved.

RequirementDescription
Server AccessRoot or admin SSH access to the server
BackupComplete server backup recommended
Domain InformationExact domain name to be removed
Technical KnowledgeBasic command line and file editing skills
Service ManagementKnowledge of starting/stopping web services

WARNING! Manual removal can break your server if done incorrectly. Proceed with caution and always backup first.

Backup Important Data

Create comprehensive backups before making any changes to ensure data recovery is possible.

  1. Backup domain files: Copy entire domain directory to safe location.
  2. Backup databases: Export all databases associated with the domain.
  3. Backup email accounts: Save email data and configurations.
  4. Backup DNS records: Document current DNS settings.
  5. Backup configuration files: Copy relevant DirectAdmin config files.

CAUTION! Without proper backups, data loss is permanent and irreversible.

Stop Related Services

Stop services to prevent conflicts during the removal process.

Service stop commands:

service httpd stop
service exim stop
service named stop
service proftpd stop

Remove Domain Files

Delete all domain-related files and directories from the server.

  1. Navigate to domains directory: cd /usr/local/directadmin/data/users/[username]/domains
  2. Remove domain entry: rm [domain.com].conf
  3. Delete public_html: rm -rf /home/[username]/domains/[domain.com]
  4. Remove SSL certificates: rm -rf /usr/local/directadmin/data/users/[username]/domains/[domain.com].key
  5. Clean backup files: rm -rf /home/[username]/backups/[domain.com]*

WARNING! Double-check paths before deleting to avoid removing wrong domains.

Clean Database Entries

Remove all database associations and user data related to the domain.

  1. Access MySQL: mysql -u root -p
  2. List databases: SHOW DATABASES LIKE '%domain%';
  3. Drop databases: DROP DATABASE [database_name];
  4. Remove database users: DROP USER '[db_user]'@'localhost';
  5. Update DirectAdmin data: Remove entries from /usr/local/directadmin/data/users/[username]/user.conf

Tip: Use FLUSH PRIVILEGES; after dropping users and databases.

Update Configuration Files

Modify DirectAdmin configuration files to remove domain references.

Key files to update:

File PathAction Required
/etc/virtual/domainsRemove domain entry
/etc/virtual/domainownersDelete domain ownership line
/etc/named.confRemove domain zone reference
/usr/local/directadmin/data/admin/ip_usageUpdate IP allocation
/usr/local/directadmin/data/task.queueClear any pending domain tasks

Restart Services

Restart all services to apply changes and ensure proper functionality.

  1. Restart web server: service httpd restart
  2. Restart email services: service exim restart && service dovecot restart
  3. Restart DNS: service named restart
  4. Restart FTP: service proftpd restart
  5. Restart DirectAdmin: service directadmin restart

CAUTION! Verify all services start without errors before proceeding.

Verification Steps

Confirm the domain has been completely removed from all systems.

CheckVerification Method
Domain AccessAttempt to access domain via browser - should show error
DirectAdmin PanelVerify domain no longer appears in user panel
DNS ResolutionCheck domain does not resolve via nslookup
Email FunctionConfirm email addresses no longer work
File SystemVerify domain directories are removed

Troubleshooting

IssuePossible CauseSolution
Domain still accessibleDNS cache or web server cacheClear cache; restart services; wait for DNS propagation
Error in service restartConfiguration syntax errorsCheck config files for syntax; verify all domain references removed
Database errorsOrphaned database entriesRecheck MySQL for remaining databases/users
Email delivery issuesRemaining email configurationsVerify /etc/virtual files cleaned properly
DirectAdmin panel errorsIncomplete user data removalCheck user.conf and domain list files

Alternative Methods

If manual removal is too complex, consider these alternative approaches:

Reset: If issues persist, restore from backup and try alternative method.

Support: Consult DirectAdmin documentation or community forums for additional help.

DirectAdmin How to Manually Remove a Domain © - All Rights Reserved 2025