Forum Moderators: phranque

Message Too Old, No Replies

Virtual host problem for info.example.com and www.example.com

         

yysummer

4:47 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



How can i setup virtual host in apacher for [info.example.com...] and http://www.example.com
<VirtualHost *>
DocumentRoot "/var/www/html"
ServerName www.example.com
</VirtualHost>

<VirtualHost *>
DocumentRoot "/var/www/info"
ServerName info.example.com

</VirtualHost>
pls help

jdMorgan

5:55 pm on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yysummer,

Welcome to WebmasterWorld!

I'm not sure what your question is, but I'd recommend that you start here [httpd.apache.org] with Name-based Virtual Hosts.

Jim

yysummer

7:15 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



hi Jim,
thanks for your reply
my question is :
i try to create 2 virtual host im my apache webserver
one is [samedomain.com...]
in /var/www/html
another is [info.samedomain.com...] in /var/www/html

but it doesn't work
two address is point to same directory var/www/html
i have read the apache guideline and config it in httpd.conf
so what's wrong on my setting

jdMorgan

9:06 pm on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you read the Apache document I cited above, you will notice that your config structure does not match the example given. You need a NameVirtualHost directive before the multiple <VirtualHost> containers.

You may also want to add a ServerAlias directive so that "example.com" --without either the www. or info. subdomains-- will resolve to the same virtual server as www.example.com.

[added] And you will need to restart your server after any change to httpd.conf in order for the changes to take effect. [/added]

Jim