LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache Virtual Host query (https://www.linuxquestions.org/questions/linux-server-73/apache-virtual-host-query-519361/)

Atif_Khan 01-15-2007 12:08 AM

Apache Virtual Host query
 
Dear friends,

This is my httpd.conf
NameVirtualHost 192.168.0.6:80

<VirtualHost 192.168.0.6:80>
DocumentRoot /var/www/vhosts/project-manager/v1.0
ServerName pm.bnv.local
</VirtualHost>

<VirtualHost 192.168.0.6:80>
DocumentRoot /var/www/vhosts/accounting/v2.0
ServerName accounting.bnv.local
</VirtualHost>

The issue is when I write 192.168.0.6 in the browser it loads the pm.bnv.local by default. I want to have Apache test page when someone types the IP in the browser.

trickykid 01-15-2007 06:44 AM

I don't think this would be a problem if this was the only site in your conf but since you have multiple virtual hosts, it's going to direct to the default and use the ServerName defined. Why would the name make any difference? Most associate names better than IP Addresses..

ScooterB 01-15-2007 08:05 AM

Another idea (and the one that I use) is to just give the second virtual host a different private IP address. Then there aren't any issues.

Wim Sturkenboom 01-16-2007 01:21 AM

Add a third virtual host before all others and let that point to the apache testpage. Although it's not guaranteed (as far as I know) that it will use that one, the chances are good that it will use it as the default.

Atif_Khan 01-16-2007 05:28 AM

Thanks Guys,

Wim your proposed solution worked for me. Thanks for help.


All times are GMT -5. The time now is 07:42 PM.