I want to serve more than one host name on a server on a specific port. Let's say namely;
example1.com, example2.com, example3.com, example4.com.
I have configured them as;
<VirtualHost example1.com:85>
ServerName www.example1.com
ServerAlias www.example1.com example1.com
.
.
.
</VirtualHost>
<VirtualHost example2.com:85>
ServerName www.example2.com
ServerAlias www.example2.com example2.com
.
.
.
</VirtualHost>
<VirtualHost example3.com:85>
ServerName www.example3.com
ServerAlias www.example3.com example3.com
.
.
.
</VirtualHost>
<VirtualHost example4.com:85>
ServerName www.example4.com
ServerAlias www.example4.com example4.com
.
.
.
</VirtualHost>
When I use this configuration, it recommands me to use NameVirtualHost and all sites goes to first one.
When I add NameVirtulHost to each one it says www.example2.com, www.example3.com and www.example4.com has no virtualhosts. And first one goes to correct one but the others goes to second one.
How can I do this configuration properly.
Generally, you only need each virtualhost to have the argument *:80, one NameVirtualHost *:80, then ServerAlias/ServerName in each VirtualHost. Using a hostname in virtualhost causes all sorts of trouble.