Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

By leonlai04
Thank you for help in advance.
I recently registered a domain name and wish to create multiple subdomains, which are to be hosted on a droplet under a single IP address using virtual hosts. The following are my desired configuration.
Domain name: example.com, subdomain 1: test, subdomain 2: forum. Droplet IP:123.45.56.76 Alias “test.example.com” point to subdomain 1 and “forum.example.com” point to subdomain 2.
Current DNS Configuration: (each field sepated by “|”) A Record: @ | 123.45.56.76 A Record: forum | 123.45.56.76 A Record: test | 123.45.56.76
CNAME: * | @ CNAME: *.forum | forum.example.com. CNAME: *test | test.example.com.
NS: ns1.digitalocean.com NS: ns2.digitalocean.com NS: ns3.digitalocean.com
I created additional CNAME record as follow to point anything other than the alias specified to www.example.com
CNAME: * | www.example.com.
The CNAME entry worked and it pointed example.com and fdasas.example.com to www.example.com, however, I got error messages on the control panel page after adding the above entry.
My other questions are regarding to virtual host configuration:
Do I need to create a separate virtual host configuration file for each virtual host under /etc/apache2/sites-available or I simply add a <VirtualHost> block on the existing default configuration?
Do each virtual host need to listen to a different port for them to work?
My config are as follow: /etc/apache2/sites-available/default ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
/etc/apache2/sites-available/test.example.com #NameVirtualHost *:80 #uncomment lead to apache2 startup error <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName test.example.com ServerAlias test.example.com
DocumentRoot /var/www/forum.example.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
I followed tutorial on these setup, but I am unsure if I need to have 1 config file for each virtual host or 1 config file for multiple virtual host.
I apologise if the question seem obscure, please let me know so I can explain better. Thank you for your help!