═══════════════════════════════════════════════════════════════════════════
            MULTI-DOMAIN SETUP - QUICK START GUIDE
═══════════════════════════════════════════════════════════════════════════

🎯 GOAL: Host multiple domains on one server with SSL certificates

═══════════════════════════════════════════════════════════════════════════
⚡ FASTEST WAY (3 steps!)
═══════════════════════════════════════════════════════════════════════════

1. Upload script to your server:
   scp multi-domain-setup.sh root@your-server-ip:~

2. SSH to server and run:
   chmod +x multi-domain-setup.sh
   sudo ./multi-domain-setup.sh

3. Select option 1 (Interactive Mode) and follow prompts!

That's it! ✅

═══════════════════════════════════════════════════════════════════════════
📝 EXAMPLE SESSION
═══════════════════════════════════════════════════════════════════════════

$ sudo ./multi-domain-setup.sh

╔═══════════════════════════════════════════════════════════════════════╗
║           MULTI-DOMAIN SETUP & MANAGEMENT TOOL                        ║
╚═══════════════════════════════════════════════════════════════════════╝

Select option: 1

Enter admin email: admin@mycompany.com
Default web root: /var/www

Enter domain name: example.com
Document root: [Press Enter for /var/www/example.com]
Include www.example.com? y
Install SSL now? y

[✓] DNS resolves correctly
[✓] Virtual host created
[✓] Site enabled
[✓] SSL certificate installed
[✓] Domain example.com setup complete!

Access: https://example.com
Upload to: /var/www/example.com

Enter domain name: site2.com
[repeat for more domains...]

Enter domain name: done

═══════════════════════════════════════════════════════════════════════════
🚀 COMMON USE CASES
═══════════════════════════════════════════════════════════════════════════

USE CASE 1: Add 3 Client Websites
──────────────────────────────────
sudo ./multi-domain-setup.sh

Option 1 (Interactive):
- client1.com → /var/www/client1
- client2.com → /var/www/client2  
- client3.com → /var/www/client3

Upload files:
scp -r client1-files/* user@server:/var/www/client1/
scp -r client2-files/* user@server:/var/www/client2/
scp -r client3-files/* user@server:/var/www/client3/


USE CASE 2: Batch Add 10 Domains
─────────────────────────────────
Create domains.csv:
domain1.com,admin@domain1.com,,,yes
domain2.com,admin@domain2.com,,,yes
domain3.com,admin@domain3.com,,,yes
... (10 total)

Run:
sudo ./multi-domain-setup.sh --file domains.csv

All 10 sites created in minutes! ⚡


USE CASE 3: Quick Single Domain
────────────────────────────────
sudo ./multi-domain-setup.sh -d mynewsite.com admin@mynewsite.com

Done in 2 minutes! ✅

═══════════════════════════════════════════════════════════════════════════
🎨 WHAT YOU GET FOR EACH DOMAIN
═══════════════════════════════════════════════════════════════════════════

For example.com:

✓ Virtual Host:
  /etc/apache2/sites-available/example.com.conf
  Configured and enabled automatically

✓ Document Root:
  /var/www/example.com/
  With beautiful default landing page

✓ SSL Certificate:
  Automatic Let's Encrypt certificate
  Auto-renewal configured
  https://example.com ready to go!

✓ Logs:
  /var/log/apache2/example.com-error.log
  /var/log/apache2/example.com-access.log

✓ Security:
  - Proper permissions (755/644)
  - Security headers configured
  - HTTP → HTTPS redirect
  - Firewall configured

═══════════════════════════════════════════════════════════════════════════
🔄 WORKFLOW
═══════════════════════════════════════════════════════════════════════════

BEFORE RUNNING SCRIPT:
1. Point DNS A record to your server IP
2. Configure AWS Security Group (ports 80, 443, 22)

RUN SCRIPT:
3. Upload and run multi-domain-setup.sh
4. Add your domains through menu

AFTER SCRIPT:
5. Upload your website files to document root
6. Test in browser
7. Done!

═══════════════════════════════════════════════════════════════════════════
📋 MENU OPTIONS
═══════════════════════════════════════════════════════════════════════════

1. 🚀 Interactive Mode      - Add domains with prompts
2. 📄 Batch Mode             - Add from CSV file
3. ➕ Quick Add              - Add single domain fast
4. 📋 List Domains           - See all configured
5. 🔒 Install SSL            - Add SSL to existing
6. ❌ Remove Domain          - Delete configuration
7. 🔄 Restart Apache         - Restart web server
8. 🧪 Test Configuration     - Validate Apache config

═══════════════════════════════════════════════════════════════════════════
💰 COST SAVINGS
═══════════════════════════════════════════════════════════════════════════

SEPARATE SERVERS:
$10/month × 10 domains = $100/month

VIRTUAL HOSTS (This Script):
$10-50/month for ALL 10 domains = $10-50/month

SAVINGS: $50-90/month or $600-1080/year! 💰

═══════════════════════════════════════════════════════════════════════════
🎯 KEY FEATURES
═══════════════════════════════════════════════════════════════════════════

✓ Fully Automated       - No manual config editing
✓ SSL Included          - Free Let's Encrypt certificates
✓ Batch Processing      - Add 10+ domains at once
✓ Smart DNS Checking    - Validates before SSL install
✓ Beautiful Defaults    - Professional landing pages
✓ Complete Isolation    - Each domain separate
✓ Easy Management       - Add/remove/list anytime
✓ Error Handling        - Won't break existing sites
✓ Secure by Default     - Best practices built-in

═══════════════════════════════════════════════════════════════════════════
🆘 TROUBLESHOOTING
═══════════════════════════════════════════════════════════════════════════

Issue: SSL fails
Fix: DNS not ready yet. Install later:
     sudo ./multi-domain-setup.sh --ssl yourdomain.com

Issue: Site shows Apache default
Fix: sudo a2ensite yourdomain.com.conf && sudo systemctl reload apache2

Issue: Can't access externally
Fix: Check AWS Security Group allows ports 80, 443

Issue: Permission errors
Fix: sudo chown -R www-data:www-data /var/www/yourdomain.com

═══════════════════════════════════════════════════════════════════════════
📚 FILES IN THIS PACKAGE
═══════════════════════════════════════════════════════════════════════════

multi-domain-setup.sh       - Main script (run this!)
domains-template.csv        - CSV template for batch mode
MULTI-DOMAIN-README.txt     - Complete documentation
QUICK-START.txt             - This file

═══════════════════════════════════════════════════════════════════════════
🎓 REMEMBER
═══════════════════════════════════════════════════════════════════════════

✓ Point DNS BEFORE running for automatic SSL
✓ Each domain is completely isolated
✓ Can add unlimited domains (within server capacity)
✓ Run script multiple times safely
✓ No SEO penalty for sharing IP address
✓ Much cheaper than separate servers
✓ Upload files to /var/www/DOMAIN/
✓ Keep list in /root/domains.txt

═══════════════════════════════════════════════════════════════════════════

Ready to get started? Run: sudo ./multi-domain-setup.sh

Need help? Read MULTI-DOMAIN-README.txt for complete guide!

═══════════════════════════════════════════════════════════════════════════
