Issue
On Amazon EC2, I have the following configuration:
<VirtualHost *:80>
ServerName a.example.com
ServerRoot /var/www/a.example.com
DocumentRoot html
</VirtualHost>
<VirtualHost *:80>
ServerName b.example.com
ServerRoot /var/www/b.example.com
DocumentRoot html
</VirtualHost>
<VirtualHost *:80>
ServerName c.example.com
ServerRoot /var/www/c.example.com
DocumentRoot html
</VirtualHost>
The problem is, that despite the above configuration being correct, all requests to any of the 3 domain names are being directed as if the request went to c.example.com
- as if the ServerName
values are just being ignored.
Anyone see a problem here?
Solution
ServerRoot
is allowed only in server config Context, not in VirtualHost
If you try to use it elsewhere, you'll get a configuration error that will either prevent the server from handling requests in that context correctly, or will keep the server from operating at all -- i.e., the server won't even start.
Answered By - Dusan Bajic Answer Checked By - Dawn Plyler (WPSolving Volunteer)