vhost apache 2

here is my config in the https-vhost


<VirtualHost api.rentsellbuy.com:80>
    ServerAdmin webmaster@rentsellbuy.com
     DocumentRoot "e:/api/rsb_api_web/"
    ServerName api.rentsellbuy.com
    ErrorLog "logs/rentsellbuy.com-error.log"
    CustomLog "logs/rentsellbuy.com-access.log" common
</VirtualHost>


<VirtualHost rentsellbuy.com:80>
    ServerAdmin webmaster@rentsellbuy.com
    DocumentRoot "C:/rsb/RENTSELLBUY_WEB/"
    ServerName www.rentsellbuy.com
    ErrorLog "logs/rentsellbuy.com-error.log"
    CustomLog "logs/rentsellbuy.com-access.log" common
</VirtualHost>

but they point to the same place
what can i do
thanks
GCI_SUPPORTAsked:
Who is Participating?
 
PapertripCommented:
The argument to the <VirtualHost> directive should be the same as the argument to the NameVirtualHost directive (ie, an IP address, or * for all addresses).
0
 
PapertripCommented:
It appears you are trying to do name based virtual hosting, since www and api resolve to the same IP.  If that is indeed what you are trying to do, then your syntax is a bit off.

http://httpd.apache.org/docs/2.0/vhosts/name-based.html

To use name-based virtual hosting, you must designate the IP address (and possibly port) on the server that will be accepting requests for the hosts. This is configured using the NameVirtualHost directive.
The next step is to create a <VirtualHost> block for each different host that you would like to serve. The argument to the <VirtualHost> directive should be the same as the argument to the NameVirtualHost directive (ie, an IP address, or * for all addresses). Inside each <VirtualHost> block, you will need at minimum a ServerName directive to designate which host is served and a DocumentRoot directive to show where in the filesystem the content for that host lives.
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

Open in new window



0
 
GCI_SUPPORTAuthor Commented:
i am a little confused,

NameVirtualHost *:80 ( i have it)

but the host is not is the same directory
0
 
PapertripCommented:
If you read through the link I provided, it should all be clear.

Declare the IP your vhosts will listen on, and put that in NameVirtualHost and in VirtualHost, then use ServerName to actually name the specific vhost and point it to the correct documentroot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.