Apache2 VirtualHost Problem?
Hello,
I have apache2 installed on my webserver (Ubuntu 20.04 LTS) and am having a time getting it to work correctly with my domain. Here is my current /etc/apache2/sites-available/tld.com.conf file. I have enabled the site with sudo a2ensite tld.com.conf.
<VirtualHost *:80>
DocumentRoot "/var/www/tld.com"
ServerName tld.com
ServerAlias www.tld.com
<Directory "/var/www/tld.com/">
Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
TransferLog /var/log/apache2/tld.com_access.log
ErrorLog /var/log/apache2/tld.com_error.log
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/subdomain.tld.com"
ServerName subdomain.tld.com
<Directory "/var/www/subdomain.tld.com/">
Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
TransferLog /var/log/apache2/subdomain.tld.com_access.log
ErrorLog /var/log/apache2/subdomain.tld.com_error.log
</VirtualHost>
As you can see I'm also trying to use a subdomain with my tld and what I'm experiencing is, when I go to subdomain.tld.com it's loading the index.html file for tld.com. When trying to visit tld.com I get the "Hmmm… can't reach this page - took too long to respond". Also, if I go to my webservers IP address instead of the domain name it's loading the web content for the subdomain and not the tld. I'm utterly confused as to why it's working backwards from what I have specified in it's config. Looking for any suggestions here.
Thank you!