On Thu, Oct 23, 2008 at 7:25 PM, Eric Covener <covener@xxxxxxxxx> wrote: > On Thu, Oct 23, 2008 at 3:54 AM, Zhen Zhou <zhouzhenzj@xxxxxxxxx> wrote: >> Hi, all, >> >> I met a strange problem for vhosts config. >> >> System information: >> Fedora 9 X86_64 >> httpd: 2.2.9 >> >> my httpd.conf which related with vhost: >> >> NameVirtualHost 61.153.33.a:80 >> >> >> <VirtualHost 61.153.33.a:80> >> DocumentRoot /var/www/html/abcorg >> ServerName www.abc.org >> </VirtualHost> >> >> <VirtualHost 61.153.33.a:80> >> ServerAdmin abc@xxxxxxx >> DocumentRoot /var/www/html/abccom >> ServerName www.abc.com >> ServerAlias abc.com *.abc.com >> ErrorLog logs/www.abc.com-error_log >> CustomLog logs/www.abc.com-access_log common >> </VirtualHost> >> >> >> NameVirtualHost 192.168.0.190:80 >> <VirtualHost 192.168.0.190:80> >> DocumentRoot /var/www/html >> ServerName 192.168.0.190 >> </VirtualHost> >> >> httpd -t -D DUMP_VHOSTS: >> >> VirtualHost configuration: >> 192.168.0.190:80 is a NameVirtualHost >> default server 192.168.0.190 (/etc/httpd/conf/httpd.conf:1017) >> port 80 namevhost 192.168.0.190 (/etc/httpd/conf/httpd.conf:1017) >> 61.153.33.a:80 is a NameVirtualHost >> default server www.abc.org (/etc/httpd/conf/httpd.conf:1000) >> port 80 namevhost www.abc.org (/etc/httpd/conf/httpd.conf:1000) >> port 80 namevhost www.abc.com (/etc/httpd/conf/httpd.conf:1005) >> wildcard NameVirtualHosts and _default_ servers: >> _default_:443 127.0.0.1 (/etc/httpd/conf.d/ssl.conf:81) >> >> Now the result is not I needed, for instance, when I access >> www.abc.org, the browser will >> feedback from /var/www/html/index.htm, but I need content from >> /var/www/html/abcorg/index.htm. >> >> error in error.log: >> [Thu Oct 23 15:50:50 2008] [error] [client 192.168.0.150] >> (13)Permission denied: access to /abcorg/index.htm denied >> >> How could I solve this problem? > > When you use an IP address in the VirtualHost tag, Apache checks if > that interface is the one associated with the request before checking > anything else. In your conf, if the local sideof the conection is > your 192.168.0.190, it can then only choose between the 192.168.0.190 > vhosts and not the other ones with the external IP address. > > You can use a single NameVirtualHost *:80 and make all your > VirtualHost containers *:80, and then the ServerName/ServerAlias will > "just work", or you can duplicate the settings for www.abc.org in a > 192.168.0.190 vhost. > > > -- > Eric Covener > covener@xxxxxxxxx > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See <URL:http://httpd.apache.org/userslist.html> for more info. > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > > Thanks for your kindly help, now I modified httpd.conf: NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html/abcorg ServerName www.abc.org </VirtualHost> <VirtualHost *:80> ServerAdmin abc@xxxxxxx DocumentRoot /var/www/html/abccom ServerName www.abc.com ServerAlias abc.com *.abc.com ErrorLog logs/www.abc.com-error_log CustomLog logs/www.abc.com-access_log common </VirtualHost> but I still got error when I access www.abc.org: [Thu Oct 23 22:37:33 2008] [error] [client 123.115.174.137] (13)Permission denied: access to /abcorg/index.htm denied. Meanwhile I could access www.abc.com without any problem.That make me very confused. httpd -S: VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: _default_:443 127.0.0.1 (/etc/httpd/conf.d/ssl.conf:81) *:80 is a NameVirtualHost default server www.abc.org (/etc/httpd/conf/httpd.conf:1000) port 80 namevhost www.abc.org (/etc/httpd/conf/httpd.conf:1000) port 80 namevhost www.abc.com (/etc/httpd/conf/httpd.conf:1005) Syntax OK Is there any folder permission I need to set in /var/www/html/abcorg ? TIA Zhou --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx