Can't Access Subdomains - Virtual Hosts Not Recognized

Hi, I have a frustrating problem.

I’ve recently migrated my websites from a fully managed dedicated server to a linode, CentOS 9, where I now have to figure out how to make everything work, so I’m just learning.

I have a primary domain, online-projects.xyz, and several subdomains, e.g. admin.online-projects.xyz, demo.online-projects.xyz, etc. The domain registrar is Namecheap.

My DNS zone file looks like this:

; online-projects.xyz [3015376]
$TTL 86400
@ IN SOA ns1.linode.com. re.lewis.comcast.net. 2021000016 14400 14400 1209600 86400
@ NS ns1.linode.com.
@ NS ns2.linode.com.
@ NS ns3.linode.com.
@ NS ns4.linode.com.
@ NS ns5.linode.com.
@ MX 10 mail.online-projects.xyz.
@ A 74.207.241.181
mail A 74.207.241.181
www A 74.207.241.181
@ AAAA 2600:3c01::f03c:94ff:fef2:bb3a
mail AAAA 2600:3c01::f03c:94ff:fef2:bb3a
www AAAA 2600:3c01::f03c:94ff:fef2:bb3a
admin 300 CNAME online-projects.xyz.
demo 30 CNAME online-projects.xyz.

My root directory is: /var/www/html

My virtual hosts conform to the following pattern:

< VirtualHost 74.207.241.181:80 >
DocumentRoot "/var/www/html/admin"
ServerName admin.online-projects.xyz
< Directory /var/www/html/admin >
AllowOverride All
allow from all
Options +Indexes
< /Directory >
< /VirtualHost >

< VirtualHost 74.207.241.181:80 >
DocumentRoot "/var/www/html/demo/webs"
ServerName admin.online-projects.xyz
< Directory /var/www/html/demo/webs >
AllowOverride All
allow from all
Options +Indexes
< /Directory >
< /VirtualHost >

THE PROBLEM

When trying to access either the primary domain or any of the subdomains, Apache returns the HTTP Server Test Page. I have tried everything I can think of to coax it into returning my landing pages but to no avail.

A typical error log reads as follows:

[Sat Jun 29 04:25:23.932928 2024] [autoindex:error] [pid 61222:tid 61360] [client 2601:644:8181:33c0:473a:2483:20c3:ff27:57275] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php,index.php) found, and server-generated directory index forbidden by Options directive

I don’t fully understand the full implications of the error message; however, if I put an index.html file into the /var/www/html directory, Apache will read the file and return its contents rather than the HTTP Server Test Page. But that does me no good. I want it to read the index file that is in /var/www/html/admin or in /var/www/html/demo/webs. That’s the way it works on my old server.

If anyone has any thoughts on what’s going on here, I’d be most appreciative to hear them.

1 Reply

Sorry, I mis-typed the ServerName in the 2nd virtual host. It should have read, demo.online-projects.xyz

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct