LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Apache Virtual Host only hitting first entry, but why? (https://www.linuxquestions.org/questions/linux-networking-3/apache-virtual-host-only-hitting-first-entry-but-why-195037/)

ridertech 06-18-2004 12:40 PM

Apache Virtual Host only hitting first entry, but why?
 
No matter which of the three address I hit, they all go to the first entry in my virtual hosts. What am I missing? Also, is it correct to use the <Directory> directive inside <VirtualHost>?

ServerName 888.888.888.888
NameVirtualHost *

# ADDRESS 1
<VirtualHost *>
ServerName *.address1.com
DocumentRoot /home/www-address1
</VirtualHost>

# ADDRESS 2
<VirtualHost *>
ServerName *.address2.net
DocumentRoot /home/www-address2
</VirtualHost>

# ADDRESS 3
<VirtualHost *>
ServerName *.address3.com
DocumentRoot /home/www-address3

<Directory "/home/www-address3">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory "/home/www-address3/admin">
Options None
AllowOverride None
AuthType Basic
AuthName "Admin Privileges Required"
AuthUserFile /usr/local/apache2/passwd/.htpasswd
Require user admin
</Directory>

<Directory "/home/www-address3/share">
Options None
AllowOverride None
AuthType Basic
AuthName "Private Share Directory"
AuthUserFile /usr/local/apache2/passwd/.htpasswd
Require valid-user
</Directory>
</VirtualHost>

david_ross 06-18-2004 01:06 PM

I think the ServerName needs to be absolute - you can then use wildcards in the ServerAlias

MadTurki 06-18-2004 01:10 PM

Yeah - I believe that's right. You'd need to have dev.address1.com, ftp.address1.com etc. all listed as serate virtual hosts

ridertech 06-18-2004 02:08 PM

My ServerName is set to my static ip address (I used 888.888.888.888 so my ip is not posted). As for the second replay, I do want everything (*.address3.com ) going to each domain name. These are three different domains.

ridertech 06-18-2004 02:23 PM

Sorry, that worked...

ServerName www.address1.com
ServerAlias address1 *.address1.com

Not sure how I missed this...
http://httpd.apache.org/docs-2.0/vhosts/name-based.html


All times are GMT -5. The time now is 09:48 PM.