Categories
Uncategorized

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 subdomain.website.com
    • sudo nano index.html
  • Configure Virtual Host
    • cd /etc/apache2/sites-available/
    • cp 000-default.conf subdomain.website.com.conf
    • nano subdomain.website.com.conf
    • Now once you are inside the config file, change the following
      • #ServerName
      • #ServerAlias
      • #DocumentRoot
  • Enabling the New Virtual Host Files
    • sudo a2ensite subdomain.website.com.conf
    • sudo a2dissite 000-default.conf
    • sudo systemctl restart apache2

 

https://docs.digitalocean.com/products/networking/dns/how-to/add-subdomain/#create-a-new-hostname-with-an-a-record

https://medium.com/@Madgeek_in/how-to-create-subdomains-on-digitalocean-lamp-df501dff5855

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04