Web Hosting Talk







View Full Version : Name-Based Virtual Servers


webhostgo
08-02-2002, 09:04 AM
Hey guys, i'm currently trying to run a server out of my home on windows. I'm using apache and I was wondering if anyone knew how to make a name based virtual server on apache? If someone could include the script I need to put in and where I should put it, that would be great. To Talk on AIM my sn is iversonwitthej@hotmail.com

ho247
08-02-2002, 09:18 AM
It's very simple to do this, there should be an example virtual host in the Apache configuration file. Take a look in the C:\Program Files\Apache Group\Apache\conf\httpd.conf (yours may be in a slightly different location) file and scroll all the way down to the bottom. You should see the below text or something similar to it:

# 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 *>
# 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>So just create your directory, and set DocumentRoot to point to it, for example:

#<VirtualHost *>
# ServerAdmin webmaster@domain.com
# DocumentRoot c:\web\domain.com
# ServerName domain.com
# ErrorLog c:\web\domain.com\logs\error_log
# CustomLog c:\web\domain.com\logs\access_log common
#</VirtualHost>I hope this helps you, if you need any further help just reply below.

Alan

webhostgo
08-02-2002, 09:27 AM
I was told earlier that i need a header on my site to tell apache which domain is coming in... is this true

freakysid
08-02-2002, 09:51 AM
Not quite correct. The client (ie, your browser) sends the domain name and requested URI in its HTTP headers that it sends when it requests the page from the Apache server. It's nothing you need to worry about :stickout

ho247
08-02-2002, 10:02 AM
I was told earlier that i need a header on my site to tell apache which domain is coming in... is this trueIn your case, yes... that's true. You're using Apache on windows on a personal computer, so you'll be accessing the web page eithre by the IP address, the computer name or "localhost", and since their's only one 'domain' there, Apache won't know which virtual host to go to, so it'll use the default DocumentRoot folder etc. If it's for personal use only, and you just want to test websites out, then I wouldn't bother with name based hosting, just use the default host, which is located at C:\Program Files\Apache Group\Apache\htdocs\ . When you put the files in there and access it via the browser at "http://localhost/", you'll see the website.

Alan

webhostgo
08-02-2002, 10:10 AM
Thanks for all your help guys but is there an apache toolkit or another http server thats as secure as apache that I could use for easier configuration of name based virtual servers?

ho247
08-02-2002, 10:19 AM
May I ask why you require name based hosting on your home computer?

There's a windows program that will allow you to edit the httpd.conf file easily, can't think of the program name at the moment though :(.

Alan

Gem Hexen
08-04-2002, 10:43 PM
Originally posted by ho247
May I ask why you require name based hosting on your home computer?

There's a windows program that will allow you to edit the httpd.conf file easily, can't think of the program name at the moment though :(.

Alan
Notepad?

webhostgo
08-05-2002, 12:56 AM
IT hosting i just wanted to say its pretty lame of you to put down members like me who are just starting (your notepad comment)... i bet you were at this point to when you were 14. My family needs some extra money and so I have decided to take a risk and make it online.

JayC
08-05-2002, 02:05 AM
Originally posted by webhostgo
IT hosting i just wanted to say its pretty lame of you to put down members like me who are just starting (your notepad comment)... I don't think that was a put down, just an answer to ho247's post. You could certainly edit httpd.conf with Notepad -- it's just a plain text file. I suppose ho247 meant that there's a Windows app that would help to make a valid setup and make valid changes to httpd.conf, but I'm only guess ing; I don't know of any such program.

ho247
08-05-2002, 03:13 AM
Not notepad, I would have thought of the name if it was... it's a different Windows program that actually takes al the info of a httpd.conf file and puts it into a set of forms which can then edit easily. After some searching on the web, I found Apache Apache Configuration Editor 1.1 (http://www.webattack.com/get/apacheconfig.shtml), which is another httpd.conf editor (not the one I was thinking of). webhostgo, you could try using that, I've not used it before, but from the screenshot it looks like it'll be very useful for what you're looking to do.

Alan

CagedTornado
08-11-2002, 01:09 AM
Not sure if you looked, but this is actually documented pretty well on the Apache site -- http://httpd.apache.org/docs/vhosts/name-based.html

Dan