Page 1 of 1

Vhost not working, what am i missing

PostPosted: 05. July 2010 17:27
by abidkhan
alright i have been following multiple examples on this site but it seems my Vhost cant work below is the setup file of https-vhost.conf

#############################################

#
# Virtual Hosts
#
# 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.2/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

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
##ServerName dummy-host.localhost
##ServerAlias http://www.dummy-host.localhost
##ErrorLog "logs/dummy-host.localhost-error.log"
##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host2.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
##ServerName dummy-host2.localhost
##ServerAlias http://www.dummy-host2.localhost
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@hkdns.tk
DocumentRoot "C:/xampp/htdocs/cater"
ServerName quickcatering.tk
ServerAlias http://www.quickcatering.tk
ErrorLog "logs/quickcatering.tk-error.log"
CustomLog "logs/quickcatering.tk-access.log" combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@hkdns.tk
DocumentRoot "C:/xampp/htdocs/hkdns"
ServerName hkdns.tk
ServerAlias http://www.hkdns.tk
ErrorLog "logs/hkdns.tk-error.log"
CustomLog "logs/hkdns.tk-access.log" combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@hkdns.tk
DocumentRoot "C:/xampp/htdocs/nexage"
ServerName nexage.tk
ServerAlias http://www.nexage.tk
ErrorLog "logs/nexage.tk-error.log"
CustomLog "logs/nexage.tk-access.log" combined
</VirtualHost>

the problem is that all my domains are pointing to the c:/xampp/htdoc/cater
now i MUST mention that i have only made changes to the vhost file, so if there is any change reuqired else where please let me know...

Re: Vhost not working, what am i missing

PostPosted: 05. July 2010 17:32
by Altrea
abidkhan wrote:alright i have been following multiple examples on this site but it seems my Vhost cant work below is the setup file of https-vhost.conf

You should read more carefully. This is a well known and often solved issue.

You want to use namebased VHosts. Why is your NameVirtualHost line not active?

Re: Vhost not working, what am i missing

PostPosted: 05. July 2010 17:52
by abidkhan
am i to activate both below lines?

# Use name-based virtual hosting.
#
##NameVirtualHost *:80

and yes i did read carefully...most of the example posted on this board about vhosts showed exact same post as mine...i didnt realise the line NameVirtualHost *:80 was part of the code...

Re: Vhost not working, what am i missing

PostPosted: 05. July 2010 18:09
by Altrea
abidkhan wrote:am i to activate both below lines?

# Use name-based virtual hosting.
#
##NameVirtualHost *:80


No, you just need to remove both # of the line ##NameVirtualHost *:80.
The other lines are just for info.

That should do the trick.

And the first VHost you define is your default VHost. All requests which haven't a name that matches will be routed there.