Click to See Complete Forum and Search --> : Virtual Servers... oh joy oh bliss


brockmasterflex
08-09-2004, 06:39 PM
Ok... Ok.... I have discovered that I am stupid, and have no clue as how these Apache "Virtual Servers" work. I did a fair bit of reading and I'm still lost. So, I have 2 sites both hosted on the same machine. This is how the end of my httpd.conf looks as of now....


### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost www.area250.com>
DocumentRoot "/var/www/area250/docs"
ServerName sulu.maxit.net
</VirtualHost>


So when I go to www.area250.com I see my test page..... however if bring up sulu.maxit.net it points me to www.area250.com's test page... i thought that it should point to the default... which would be /var/www/html/ NOT /var/www/area250/

Any help would be GREATLY appreciated.

BMF

bwkaz
08-09-2004, 06:49 PM
The first VirtualHost is the default one, IIRC... ;)

If you want a different DNS name to point to a different virtual host, then I'm pretty sure you need to make another <VirtualHost> section.

brockmasterflex
08-09-2004, 07:07 PM
ok... oops... forgot about that.... here is the real httpd.conf...


### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName sulu.maxit.net
</VirtualHost>

<VirtualHost www.area250.com>
DocumentRoot "/var/www/area250/docs"
ServerName sulu.maxit.net
</VirtualHost>


still no worky.....

bmf

brockmasterflex
08-09-2004, 07:37 PM
Ok... ok.... did alittle more reading ... this time on ... you guessed it apache's website......

now this works....



### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerName sulu.maxit.net
DocumentRoot /var/www/html/
</VirtualHost>

<VirtualHost *:80>
ServerName www.area250.com
DocumentRoot "/var/www/area250/docs"
</VirtualHost>


Man.... i need more carbs..... this diet is eating my brain.... :P

bmf

sharth
08-09-2004, 11:01 PM
If you use virtual hosts, it doens't care about what you set as the default in the earlier section. make a new virtual host for the other site.