Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


vhost apache 2

Posted on 2011-10-19
Medium Priority
Last Modified: 2012-05-12
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 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

but they point to the same place
what can i do
Question by:GCI_SUPPORT
  • 3
LVL 21

Expert Comment

ID: 36994339
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.


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

Open in new window


Author Comment

ID: 36994363
i am a little confused,

NameVirtualHost *:80 ( i have it)

but the host is not is the same directory
LVL 21

Expert Comment

ID: 36994382
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.
LVL 21

Accepted Solution

Papertrip earned 2000 total points
ID: 36994393
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).

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question