LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache virtual hosts (https://www.linuxquestions.org/questions/linux-software-2/apache-virtual-hosts-195419/)

Red Squirrel 06-19-2004 03:24 PM

apache virtual hosts
 
I just made a virtual host on my LAN server, it works, but the problem is that it does not only work for the given host, but for the whole server, so basically it just overrides the rest of the settings. The main hostname of the server is borg, and the virtual host is *.ebay.* but even if I access the server with borg, it still goes to the virtual host. Why?!

So I tried to create another virtual host called borg, but it said I can only have one, and the first one takes priority.... that's odd since I thought it was possible to have more then one virtual host... it sort of defeats the purpose if I'm limited to one per server.

Is there a way to get this to work properly? I need to do this in order to block ebay from my network and have it so it says it's down, so I will add ebay in the hosts file on the computer downstairs. But I still need to be able to access the root portion of my server the way it is under the root host. Thanks in advance!

trickykid 06-19-2004 03:38 PM

httpd.conf file posted here please.. or we're clueless as you are. And any more details will help you may have.

Red Squirrel 06-19-2004 03:50 PM

<VirtualHost *:80>
ServerAdmin webmaster@ebay.ca
DocumentRoot /data/intranet/main/ebay
ServerName *.ebay.*
errordocument 404 /data/intranet/main/ebay/index.php
</VirtualHost>

That's the part I modified, so anything with ebay in it should use it, otherwise use the server's root settings (which are working correctly without the virtual host part added.)

I tried putting

another one like this:

<VirtualHost *:80>
DocumentRoot /data/intranet/main/www
ServerName borg
</VirtualHost>

But it says it can't resolve borg. But I figured if it does not comply with the ebay one, it should just use the root settings, no?

Cerbere 06-20-2004 04:37 AM

Two things to try:

1) You need a 'NameVirtualHost *:80' (just one) directive before the two <VirtualHost *:80> directives.

2) Change your 'ServerName *.ebay.*' to 'ServerName ebay.com', then use 'ServerAlias *.ebay.*'

I'd also suggest you switch the two VH's so borg comes first, because any ambiguous requests will default to the first VH.

And trickykid, why speaking like yoda are you?

Enjoy!
--- Cerbere

trickykid 06-20-2004 09:05 AM

Also if you have your main configuration already setup to use port 80, you really don't need to specify the port in your virtual hosts config either, something like this is doable:

<VirtualHost *>
ServerAdmin webmaster@ebay.ca
DocumentRoot /data/intranet/main/ebay
ServerName ebay.com
ServerAlias *.ebay.*
errordocument 404 /data/intranet/main/ebay/index.php
</VirtualHost>

<VirtualHost *>
DocumentRoot /data/intranet/main/www
ServerName borg
</VirtualHost>


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