On 07/10/2012 10:20 AM, Roland Roland wrote:
Can anyone help me out in understand how/why virtual host take precedence on the same ip ?The first defined/created virtual-host serves as the default when nothing else matches. How are you defining your virtual-hosts?like i always face an issue where two distinct virtual hosts are set.the first works, the second doesn't unless i bump it up so it becomes the first listed in the conf file.--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
Chances are you don't have them set up correctly. example (* matches on any IP apache is bound on.): NameVirtualHost * <VirtualHost *> # when nothing else matches ServerName or ServerAlias, apache comes here ServerAdmin <email address> ServerName example.com ServerAlias www.example.com DocumentRoot "/path/to/files" DirectoryIndex index.php index.htm ... </VirtualHost> <VirtualHost *> # matches on ServerName or ServerAlias ServerAdmin <email address> ServerName example2.com ServerAlias www.example2.com DocumentRoot "/path/to/files2" DirectoryIndex index.php index.htm ... </VirtualHost> <VirtualHost *> # matches on ServerName or ServerAlias ServerAdmin <email address> ServerName example3.com ServerAlias www.example3.com DocumentRoot "/path/to/files3" DirectoryIndex index.php index.htm ... </VirtualHost>The 'NameVirtualHost *' directive may be located in your main apache (httpd) .config file, and your VirtualHosts could be in the same file or a separate .config file, or individual files themselves. If all together then make the first one point to a default setup (site map?, redirect?). If individual files then make sure the default VirtualHost filename is something guaranteed to be loaded first, like '000-default' or similar. I think my initial installation came that way.
-- Norman Registered Linux user #461062 -Have you been to www.apache.org yet?- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx