From Shared Hosting to Self-Hosted Infrastructure Mastery
Topic: Server Administration & Migration
Level: Intermediate to Advanced
Duration: 6-8 Hours Practical
Prerequisites: Basic Linux Command Line
π Introduction
Learning Objective: Understand the complete process of migrating from managed cPanel hosting to self-managed VPS infrastructure, gaining full control over web services.
This educational document covers the real-world migration of jazila-traders.com from cPanel to a self-managed Ubuntu 22.04 VPS. Every command, configuration, and troubleshooting step is documented from actual implementation.
Real-World Context: This guide is based on actual production server migration, including all errors encountered and their solutions.
Document all domains, subdomains, databases, email accounts, and cron jobs in cPanel.
# Check cPanel account structure
ls -la /home/username/
# List databases
mysql -e "SHOW DATABASES;"
2
Resource Analysis
Analyze disk usage, bandwidth patterns, and database sizes to plan VPS specifications.
# Check disk usage
du -sh /home/username/*
# Check database sizes
mysql -e "SELECT table_schema 'Database', SUM(data_length + index_length) 'Size' FROM information_schema.TABLES GROUP BY table_schema;"
3
DNS Preparation
Reduce TTL values to 300 seconds for faster DNS propagation during cutover.
Pro Tip: Lower TTL 24-48 hours before migration to minimize downtime.
π₯οΈ Phase 2: VPS Foundation Setup
Learning Objective: Master initial server configuration, security hardening, and service stack installation.
# Test configuration
sudo named-checkconf
sudo named-checkzone jazila-traders.com /var/lib/bind/jazila-traders.com.hosts
DNS Fundamentals: Understand the difference between A records (address), NS records (name server), MX records (mail exchange), and CNAME records (canonical name).
SSL Troubleshooting: Wildcard certificates (*.domain.com) may require different Apache configuration. Use cert.pem + chain.pem instead of fullchain.pem if encountering issues.
Symptoms: Domain resolves locally but not externally, SERVFAIL errors.
# Test local resolution
dig @localhost domain.com
# Test external resolution
dig @1.1.1.1 domain.com
# Check nameservers
whois domain.com | grep "Name Server"
π― Key Takeaways
Infrastructure Independence: Moving from managed hosting to self-managed VPS provides complete control and cost efficiency
DNS Mastery: Understanding BIND configuration is crucial for reliable web services
Security First: Proper firewall configuration and service hardening are non-negotiable
Troubleshooting Skills: Real-world server administration requires systematic debugging approaches
Backup Strategy: Always maintain recent backups before major configuration changes
Documentation: Comprehensive documentation saves hours of troubleshooting
π§ Knowledge Check
Question 1: What is the purpose of reducing DNS TTL before migration?
Answer: Lower TTL (Time To Live) allows faster DNS propagation during cutover, minimizing potential downtime when switching to new servers.
Question 2: Why might a wildcard SSL certificate (*.domain.com) not work for the main domain?
Answer: Some Apache versions have issues with wildcard certificates in fullchain.pem. The solution is to use cert.pem + chain.pem separately or get a dedicated certificate.
Question 3: What does the "SERVFAIL" DNS error indicate?
Answer: SERVFAIL indicates the nameserver is unable to process the query due to configuration errors, DNSSEC issues, or service problems.
π Conclusion
This comprehensive migration from cPanel to self-managed VPS demonstrates the journey from dependency on managed hosting to complete infrastructure control. The skills acquiredβDNS management, web server configuration, SSL implementation, and systematic troubleshootingβare fundamental to modern web administration.
Real-World Application: Every command and configuration in this document was tested and implemented in a production environment, providing authentic learning experiences for students.
By mastering these skills, you transition from being a user of web services to becoming a creator and maintainer of web infrastructureβa crucial step in professional web development and system administration careers.