PDA

View Full Version : Question about NameVirtualHost




bwan37
Oct 12, 2012, 04:25 AM
Hi, I have my web server up and running with with TCP:80 all setup,
but now I have got another problem when dealing with virtualHost

here's my mission:
www.ben-wan.com point to /WebServer/benwan
www.irisecret.com point to /WebServer/irissecret

my problem.
www.ben-wan.com goes to /WebServer folder.

here's my actual config files....

#inside /private/etc/apache2/httpd.conf
ServerName www.ben-wan.com:80
DocumentRoot "/volumes/storage/WebServer"
Include /private/etc/apache2/extra/httpd-vhosts.conf

#inside /private/etc/apache2/extra/httpd-vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.ben-wan.com
ServerAlias *.ben-wan.com
DocumentRoot "/WebServer/benwan"
ServerSignature Off
# ErrorLog "/WebServer/benwan/log/ben-wan.com-error_log"
# CustomLog "/WebServer/benwan/log/ben-wan.example.com-access_log" common
<Directory "/WebServer/benwan">
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
<Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.irisecret.com
ServerAlias *.irisecret.com
DocumentRoot "/WebServer/irissecret"
ServerSignature Off
# ErrorLog "/WebServer/benwan/log/irissecret.com-error_log"
# CustomLog "/WebServer/benwan/log/irissecret.example.com-access_log" common
<Directory "/WebServer/irissecret">
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
<Directory>
</VirtualHost>

#inside /private/etc/host/hosts
127.0.0.1 ben-wan.com
127.0.0.1 irisecret.com

Can someone give me a hand in solving this problem.
Thanks a great deal.



assembled
Oct 12, 2012, 05:13 AM
you've given the default server the same host header

here's my actual config files....

#inside /private/etc/apache2/httpd.conf
ServerName www.ben-wan.com:80
DocumentRoot "/volumes/storage/WebServer"

try

#inside /private/etc/apache2/httpd.conf
ServerName webserver
DocumentRoot "/volumes/storage/WebServer"

bwan37
Oct 12, 2012, 07:57 AM
I have changed www.ben-wan.com to webserver
but may I know what this does?
cause I try typing http://webserver but it return "cannot find server webserver"

can I put in "ServerName 127.0.0.1:80" instead?

"btw, problem solved for this code..

<VirtualHost *:80>
....
<Directory "...">
...
<Directory> <---- Need to close this...
</VirtualHost>