Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Setting up virtual hosts on Apache

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Invalid method in request error  
Author Message
mail18

External


Since: Mar 30, 2004
Posts: 2



(Msg. 1) Posted: Tue Mar 30, 2004 3:01 am
Post subject: Setting up virtual hosts on Apache
Archived from groups: alt>apache>configuration (more info?)

Hello everyone,
I've a question which I'm sure the experienced among you will know the
answer to immediately.

I'm attempting to develop several sites on my laptop, with the assets
for each in a different folder. I want to make each of these folders a
separate webserver document root, so that I can test each of my sites
independently.

I imagine that virtual hosts are the answer, here.

But I'm having a rather interesting time trying to set up said virtual
hosts. The story so far runs like this:

in my httpd.conf file,

(a) I've enabled name-based virtual hosting with this line:

NameVirtualHost 127.0.0.1:80

- hopefully the loopback IP is OK, here. I am only doing personal
testing after all ... I don't have any requirement to actually webshare
with anyone else, or anything

(b) I also added these vhost descriptions:

<VirtualHost *>
ServerName dev0
DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev0
</VirtualHost>

<VirtualHost dev1>
ServerName dev1
DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev1
</VirtualHost>

(c) I added the corresponding directories dev0 and dev1 at the
locations indicated, and placed a trivial index.html file within each
one:

dev0/index.html displays the message "reached dev0";
dev0/index.html displays the message "reached dev1

-----------------------

So what happens? Well, I have success, partly. If I type "localhost"
into the address bar and hit return, I am rewarded with

reached dev0

This is correct, I think; the first vhost description begins with
<VirtualHost *>, and is meant to be used when no hostname is specified
in the http request, if I understand the Apache docs.

But how do I access the dev1 virtual host? I cannot for the life of me
seem to figure this out. Apparently, there is a "host:" attribute to
supply in the 'header' - whatever that is.

do i specify the host in the URL in some way? If so, then how is this
done? I have tried just about every combination I can think of!

Any advice, or pointers to some online documentation would be warmly
welcomed at this point, ladies and gents Smile

Kind regards,


Clive Green

--
Clive Green

 >> Stay informed about: Setting up virtual hosts on Apache 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 2) Posted: Tue Mar 30, 2004 4:53 am
Post subject: Re: Setting up virtual hosts on Apache [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Clive Green" <mail DeleteThis @clivegreen.com> schreef in bericht
news:300320040001036336%mail@clivegreen.com...
 > (a) I've enabled name-based virtual hosting with this line:
Just making some changes in between to make life easy

 > NameVirtualHost 127.0.0.1:80
useCanonicalName off
listen 80
NameVirtualHost *

 > (b) I also added these vhost descriptions:
 >
 > <VirtualHost *>
 > ServerName dev0
You're displeasing the *nix-(wo)men Wink
ServerName 111.domain.tld

 > DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev0
 > </VirtualHost>
 >
 > <VirtualHost dev1>
 > ServerName dev1
<VirtualHost *>
ServerName 222.domain.tld

 > DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev1
 > </VirtualHost>

 > But how do I access the dev1 virtual host? I cannot for the life of me
 > seem to figure this out. Apparently, there is a "host:" attribute to
 > supply in the 'header' - whatever that is.
Right ... whatever it is, it is mandatory and comes with almost no cost if
you use the poor man's DNS the file hosts' somewhere in a folder named
'etc'. Open that file and add these entries
127.0.0.1 111.domain.tld
127.0.0.1 222.domain.tld

Browse your way to <a style='text-decoration: underline;' href="http://222.domain.tld" target="_blank">http://222.domain.tld</a>

Do the same on any other machine in your local network, replacing
localhost's address with the LAN-IP of the one running Apache and brows from
there, all thanks to the asterics in NameVirtualhost

If you have scripts baking cookies, let it make them domain cookies. It
makes your script works for all servers, 'www.domain.tld' just as well as
for '111.domain.tld' or 'xyz.domain.tld'.


 > Any advice, or pointers to some online documentation
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/mod/core.html#namevirtualhost" target="_blank">http://httpd.apache.org/docs-2.0/mod/core.html#namevirtualhost</a>


HansH<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Setting up virtual hosts on Apache 
Back to top
Login to vote
mail18

External


Since: Mar 30, 2004
Posts: 2



(Msg. 3) Posted: Tue Mar 30, 2004 10:33 am
Post subject: Re: Setting up virtual hosts on Apache [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Many, many thanks for that, Hans ‹ I am now completely 'sorted', after
that sage advice of your; everthing is tickety boo!

So .... THAT'S how it works Smile

Brilliant - thanks again, sir. You have made my day - seriously.

Clive Green

--
Clive Green
 >> Stay informed about: Setting up virtual hosts on Apache 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Access apache virtual hosts - Hello, I have a network at home with 2 PCs with WinXp. On PC1 run's apache with some virtual hosts. (see config below) If I write demo or demo1 or demo2 into the browser on PC1 it works fine. But how can I access them from the other computer? Thanks! ...

NAT and Apache cofiguration (without virtual hosts !) - Hi All, I have DSL with static IP and NAT. (apache + linux) for example: external IP of router- 69.1.1.1 internal IP of my web server - 192.168.1.5 httpd.conf Listen 192.168.1.5:80 ServerName 69.1.1.1:80 If I open port in my router and ask to redirect...

Apache 2.0.40 (RH9) virtual hosts vs. mod_proxy vs ssl - Hi all, i´m using the standard rh9 apache config with ssl enabled, which works fine. now i want to redirect an other domain via mod_proxy to an other apache server without using ssl. i´ve tried to setup a virtual host with this config: ......

apache/tomcat virtual hosts - I have set up tomcat and apache... bind them with a JK2 connector both on port 80. I have 2 domains running on the machine. the apache docs are located on the following location: /export/home/webroot/site1 (www.site1.com) /export/home/webroot/site...

virtual hosts apache/tomcat - Ok, finaly have apache and tomcat running both on port 80. I have created the following dir's /export/home/www.someserver.com /export/home/mnt.someserver.com This will be the location of http://www.someserver.com and http://mnt.someserver.com To test...
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]