Atavism Linux Server Install

Introduction

  • Brief overview of Apache2 virtual hosts.
  • Purpose of the lesson: guiding through disabling the default website and setting up a new site for the ‘patch’ subdomain.

Section 1: Understanding Apache2 Virtual Hosts

  • Explanation of Virtual Hosts: How they allow Apache2 to serve different content for different domains or subdomains.
  • Default Virtual Host: Its role and why it might need to be disabled.

Section 2: Disabling the Default Apache2 Site

  1. Access Apache2 Sites-Available Directory:
    • Navigate to /etc/apache2/sites-available/.
    • List available sites using ls command.
  2. Disable the Default Site:
    • Command: sudo a2dissite 000-default.conf (for Debian/Ubuntu).
    • Explanation: ‘a2dissite’ disables a site by removing the symlink from ‘sites-enabled’.
  3. Restart Apache2:
    • Command: sudo systemctl restart apache2.
    • Explanation: Ensures changes are applied.

Section 3: Setting Up a New Site for ‘patch’ Subdomain

  1. Create a Configuration File for ‘patch’ Subdomain:
    • Navigate to /etc/apache2/sites-available/.
    • Use sudo nano patch.example.com.conf to create a new configuration file (replace example.com with your domain).
  2. Configure the Virtual Host for ‘patch’ Subdomain:
    • Basic structure to include:
      <VirtualHost *:80>
      ServerAdmin we*******@***********le.com
      ServerName patch.example.com
      DocumentRoot /var/www/patch
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      </VirtualHost>
    • Explanation: Sets up the subdomain with a designated document root and log files.
  3. Enable the ‘patch’ Site:
    • Command: sudo a2ensite patch.example.com.conf.
    • Explanation: Creates a symlink in ‘sites-enabled’ to enable the site.
  4. Restart Apache2:
    • Same as above.

Section 4: Testing the New Subdomain

  • Suggest methods for testing, such as accessing the subdomain in a browser or using tools like curl.

Conclusion

  • Summary of steps taken.
  • Encouragement for further exploration and customization.
  • Remind the importance of regular maintenance and updates.

Additional Resources

  • Links to Apache2 documentation for advanced configurations.
  • Community forums for additional support and learning.

Interactive Elements:

  • Quiz: Test understanding of virtual hosts and configuration changes.
  • Hands-on Lab: Practice setting up a new virtual host.
  • Discussion Board: Share experiences and troubleshoot common issues.

This lesson will provide a comprehensive guide to managing Apache2 virtual hosts, specifically focusing on setting up a new subdomain while disabling the default site. Remember to emphasize the importance of backups before making significant changes to server configurations.