Query on Name-Based Virtual host (Default Virtual Host Block)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi,

 

Is it mandatory that the first virtual host block should contain default host DocumentRoot so that resources can be accessed through virtual host server?

 

If I configure httpd.conf for Apache Webserver 2.0.59 (on Solaris) as below

with

enterprise3.xyz.com pointing to Document Root as /usr/ga/Apa/htdocs   (default host)

vs1.xyz.com pointing to Document Root as /usr/ga/Apa/htdocs1  (virtual server)

vs2.xyz.com pointing to Document Root as /usr/ga/Apa/htdocs2  (virtual server)

I can access corresponding resources in each of these servers.

 

But if I remove the first Virtual Host block (i.e., used as default host) then I can’t access any of the resources in these 3 servers.

If I remove the first Virtual Host block and if the second VirtualHost block is modified to DocumentRoot as /usr/ga/Apa/htdocs (keeping everything else same as earlier setup), I can access the resources in /usr/ga/Apa/htdocs through vs1.xyz.com (and can’t access the resources from other 2 servers).

 

Is it mandatory that the first virtual host block should contain default host DocumentRoot (if the first virtual host block is not the default host) so that resources can be accessed through virtual host server?

 

# Use name-based virtual hosting.

NameVirtualHost *:80

<VirtualHost *:80>

    ServerAdmin webmaster@xxxxxxxxxxxxxxxxxxxxxx

    DocumentRoot /usr/ga/Apa/htdocs

    ServerName enterprise3.xyz.com

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

<VirtualHost *:80>

    ServerAdmin webmaster@xxxxxxxxxxxxxxxxxxxxxx

    DocumentRoot /usr/ga/Apa/htdocs1

    ServerName vs1.xyz.com

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

<VirtualHost *:80>

    ServerAdmin webmaster@xxxxxxxxxxxxxxxxxxxxxx

    DocumentRoot /usr/ga/Apa/htdocs2

    ServerName vs2.xyz.com

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

 

 

 

Regards,

Anil

 


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux