Questions regarding DNS configuration for multiple subdomain under 1 IP address?
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:220.127.116.11 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: @ | 18.104.22.168 A Record: forum | 22.214.171.124 A Record: test | 126.96.36.199 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 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 Options FollowSymLinks AllowOverride None /etc/apache2/sites-available/test.example.com #NameVirtualHost *:80 #uncomment lead to apache2 startup error ServerAdmin webmaster@localhost ServerName test.example.com ServerAlias test.example.com DocumentRoot /var/www/forum.example.com/public_html Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all 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!