Create Subdomain at DigitalOcean (Apache)

  • Create a New Hostname with an A Record
    • To add the hostname from the control panel, click Networking in the main menu. In the Domains tab, click the domain name you would like to add the new hostname to.
    • In the Create new record screen, click the A tab.
  • Create sub directory & host project files
    • Create a directory under /var/www/ the directory using the commands
    • cd /var/www/
    • mkdir
    • sudo nano index.html
  • Configure Virtual Host
    • cd /etc/apache2/sites-available/
    • cp 000-default.conf
    • nano
    • Now once you are inside the config file, change the following
      • #ServerName
      • #ServerAlias
      • #DocumentRoot
  • Enabling the New Virtual Host Files
    • sudo a2ensite
    • sudo a2dissite 000-default.conf
    • sudo systemctl restart apache2