You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Luc Foisy <Lu...@technical-magic.com> on 2003/02/12 18:55:47 UTC

[users@httpd] Name based Virtual Host configuration

Perhaps I don't fully understand the concepts involved, but I think I am having difficulties configuring name based virtual hosts.
I am using server version 2.0.40 on Red Hat 8.0, The servers local IP address is 192.168.1.100
The incoming traffic will be directed though a router to the 192.168.1.100 server.

The scenario I wish to cover:
I have two names www.asite.com and www.thesite.com
I have internic pointing both of those addresses at my outside address of 222.222.222.222

The pages that belong to www.asite.com are in /var/www/asite/html
The pages that belong to www.thesite.com are in /var/www/thesite/html


Could someone give me the entries in httpd.conf that would make that work.

I tried using (this is from memory mind you)

NameVirtualHost *

<VirtualHost *>
	ServerName www.asite.com
	/var/www/asite/html
</VirtualHost>

<VirtualHost *>
	ServerName www.thesite.com
	/var/www/thesite/html
</VirtualHost>

But that gave me an error when I restarted the httpd service

Then I tried:

NameVirtualHost www.asite.com
NameVirtualHost www.thesite.com

<VirtualHost www.asite.com>
	ServerName www.asite.com
	/var/www/asite/html
</VirtualHost>

<VirtualHost www.thesite.com>
	ServerName www.thesite.com
	/var/www/thesite/html
</VirtualHost>

And that restarted fine, but it serves the default page

Then I tried: (cause I really don't understand the documentation)

NameVirtualHost www.asite.com

<VirtualHost www.asite.com>
	ServerName 192.168.1.100
	/var/www/asite/html
</VirtualHost>

And that served the default page

So then I tried:(cause I wanted to test it from an internal http request)

NameVirtualHost www.asite.com
NameVirtualHost 192.168.1.100

<VirtualHost www.asite.com>
	ServerName 192.168.1.100
	/var/www/asite/html
</VirtualHost>

<VirtualHost 192.168.1.100>
	ServerName 192.168.1.100
	/var/www/asite/html
</VirtualHost>

And it served the page I wanted it to before. I am not exactly sure why...


If anyone can take a few moments to assist my understanding, It would make me quite happy :)

Luc

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Name based Virtual Host configuration

Posted by Gary Turner <kk...@sbcglobal.net>.
Luc Foisy wrote:

>
>Perhaps I don't fully understand the concepts involved, but I think I am having difficulties configuring name based virtual hosts.

You might check your mail agent, and set word wrap to a sane value; 72
columns seems to work well.

>I am using server version 2.0.40 on Red Hat 8.0, The servers local IP address is 192.168.1.100
>The incoming traffic will be directed though a router to the 192.168.1.100 server.
>
>The scenario I wish to cover:
>I have two names www.asite.com and www.thesite.com
>I have internic pointing both of those addresses at my outside address of 222.222.222.222
>
>The pages that belong to www.asite.com are in /var/www/asite/html
>The pages that belong to www.thesite.com are in /var/www/thesite/html
>
>
>Could someone give me the entries in httpd.conf that would make that work.
>
<snip>

This could very well be the blind leading the blind, but...

NameVirtualHost *

<VirtualHost *>
	ServerName www.asite.com
	DocumentRoot /var/www/asite/html
</VirtualHost>

<VirtualHost *>
	ServerName www.thesite.com
	DocumentRoot /var/www/thesite/html
</VirtualHost>

Earlier in the config you have a Port directive, right?

Port 80

That should do it.  Reread the manual, for a better handle on it.

http://httpd.apache.org/docs/vhosts/index.html
--
gt                  kk5st@sbcglobal.net
 If someone tells you---
 "I have a sense of humor, but that's not funny." 
                                  ---they don't.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Name based Virtual Host configuration

Posted by "J. Greenlees" <ja...@x-mail.net>.
Quoting Luc Foisy <Lu...@technical-magic.com>:

~snip~

> Could someone give me the entries in httpd.conf that would make that > work.

~snip~

look through the list archives for a post where the subject is
Specific Configuration

and the author is Boyle Owen

he put a perfect example of both name and ip based virtual host configuration in that post.


-------------------------------------------------------------------------------------------
***Protect your PC from local E-Mail Application security holes***
***Maintain your Privacy - Passport Free***
***Anti SPAM "Whitelist" feature***

http://www.x-mail.net Web Based E-Mail, accessible anywhere

Voice Messages, Voice Calls, Live Chat, X-Mail Messenger,
Personal Web Hosting, 128 bit SSL Secure, Calendar, Bookmarks,
Forwarding, Virtual Mail Map Aliasing

X-Mail Premium: 20MB Messages, 100MB Storage, POP3, Ad Free

  



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org