I need some help with virtual hosts in apache

I need some help with virtual hosts in apache

Post by Mike » Thu, 06 Jan 2000 04:00:00



I'm running apache 1.3.9 on FreeBSD 3.3.  I registered a domain and have all
that working correctly ( I think).  It is www.atmontereybay.com.  Now I want
to add virtual domains.  for example mike.atmontereybay.com.

I created aliases in the rc.conf, and added the following to httpd.conf

<VirtualHost localhost.atmontereybay.com>

DocumentRoot    /usr/local/www/data
ServerName      localhost.atmontereybay.com
</VirtualHost>

<VirtualHost www.atmontereybay.com>

ServerName      www.atmontereybay.com
DocumentRoot    /usr/local/www/data
</VirtualHost>

<VirtualHost 199.182.49.39>
ServerName      mike.atmontereybay.com

DocumentRoot    /usr/local/www/mike/htdocs
</VirtualHost>

If I try to access mike.atmontereybay.com, I get the www.atmontereybay.com
page.  The index.html file in /usr/local/www/mike/htdocs reads "Can you see
this".  I also tried using <VirtualHost mike.atmontereybay.com> instead of
the ip address but the results were the same- it brought up
www.atmonterebay.com.

Can anyone help me get beyond this?

Thanks in advance,
Mike Gideon


 
 
 

I need some help with virtual hosts in apache

Post by Christopher Kings-Lynn » Fri, 07 Jan 2000 04:00:00


OK,

I assume that you have registered the domain and configured BIND8 so that
you are the nameserver for your domain.  You will have to create BIND
entries for all the machines you want to have under your domain, www, mike,
etc.  I'll leave that info to someone more experienced with BIND however.

To use name-based virtual hosts in Apache, you will need the following line
before your first VirtualHost definition:

NameVirtualHost <IP-address>

Where <IP-address> is the IP address of your machine.

I suggest something like the following (assuming that your machine's IP is
199.182.49.39 and you are using name-based vhosts), although I'm not sure of
the specifics of your setup...

NameVirtualHost 199.182.49.39

<VirtualHost 199.182.49.39>

    DocumentRoot /usr/local/www/data
    ServerName www.atmontereybay.com
    ErrorLog /var/log/www_error_log
    CustomLog /var/log/www_access_log
</VirtualHost>

<VirtualHost 199.182.49.39>

    DocumentRoot /usr/local/www/mike/htdocs
    ServerName mike.atmontereybay.com
    ErrorLog /var/log/mike_error_log
    CustomLog /var/log/mike_access_log
</VirtualHost>

You should have to worry about the localhost.  Bear in mind that once you
put in the NameVirtualHost directive, you can ONLY have virtual hosts, the
default host will no longer work.  This config also lets you log your
different subdomains separately...

Chris


> I'm running apache 1.3.9 on FreeBSD 3.3.  I registered a domain and have
all
> that working correctly ( I think).  It is www.atmontereybay.com.  Now I
want
> to add virtual domains.  for example mike.atmontereybay.com.

> I created aliases in the rc.conf, and added the following to httpd.conf

> <VirtualHost localhost.atmontereybay.com>

> DocumentRoot    /usr/local/www/data
> ServerName      localhost.atmontereybay.com
> </VirtualHost>

> <VirtualHost www.atmontereybay.com>

> ServerName      www.atmontereybay.com
> DocumentRoot    /usr/local/www/data
> </VirtualHost>

> <VirtualHost 199.182.49.39>
> ServerName      mike.atmontereybay.com

> DocumentRoot    /usr/local/www/mike/htdocs
> </VirtualHost>

> If I try to access mike.atmontereybay.com, I get the www.atmontereybay.com
> page.  The index.html file in /usr/local/www/mike/htdocs reads "Can you
see
> this".  I also tried using <VirtualHost mike.atmontereybay.com> instead of
> the ip address but the results were the same- it brought up
> www.atmonterebay.com.

> Can anyone help me get beyond this?

> Thanks in advance,
> Mike Gideon




 
 
 

I need some help with virtual hosts in apache

Post by tim » Sat, 08 Jan 2000 04:00:00


hallo ...

if apache is too much a pain ... try thhpd (it's in the ports).

It's very handy to configure as a virtual host ... it's small, quick and your
machine barely notices that it's running. It's a good choice if you want a
*simple* no frills web server.

tim


> I'm running apache 1.3.9 on FreeBSD 3.3.  I registered a domain and have all
> that working correctly ( I think).  It is www.atmontereybay.com.  Now I want
> to add virtual domains.  for example mike.atmontereybay.com.

> I created aliases in the rc.conf, and added the following to httpd.conf

> <VirtualHost localhost.atmontereybay.com>

> DocumentRoot    /usr/local/www/data
> ServerName      localhost.atmontereybay.com
> </VirtualHost>

> <VirtualHost www.atmontereybay.com>

> ServerName      www.atmontereybay.com
> DocumentRoot    /usr/local/www/data
> </VirtualHost>

> <VirtualHost 199.182.49.39>
> ServerName      mike.atmontereybay.com

> DocumentRoot    /usr/local/www/mike/htdocs
> </VirtualHost>

> If I try to access mike.atmontereybay.com, I get the www.atmontereybay.com
> page.  The index.html file in /usr/local/www/mike/htdocs reads "Can you see
> this".  I also tried using <VirtualHost mike.atmontereybay.com> instead of
> the ip address but the results were the same- it brought up
> www.atmonterebay.com.

> Can anyone help me get beyond this?

> Thanks in advance,
> Mike Gideon



 
 
 

1. Apache 1.3b2: Default Host and all virtual hosts serve only first virtual hosts pages?

Hello.

Have been running 1.2b8 for a intranet and decided to move upto 1.3b2. I
have several name based virtual hosts that have been working under
1.2b8. After compiling and installing 1.3b2 my virtual hosts do not
work. In fact what happens is that even though DocumentRoot and default
server name is different, eg: www.serverA.net pointing to /www/default,
Apache 1.3b2 will always take me to the first defined virtual host as if
it's locked to it no matter what virtual host I try to browse. What
gives? Please post and E-Mail.

In /etc/hosts for my machines IP address I have

A.B.C.D         www.default.net www.virtA.net www.virtB.net

In ../conf/httpd.conf I have;

<VirtualHost www.virtA.net>

DocumentRoot /usr/local/www/virtA
ServerName www.virtA.net
ErrorLog logs/virtA.error.log
TransferLog logs/virtA.access.log
</VirtualHost>

<VirtualHost www.virtB.net>

DocumentRoot /usr/local/www/virtB
ServerName www.virtB.net
ErrorLog logs/virtB.error.log
TransferLog logs/virtB.access.log
</VirtualHost>

--

2. Proc Table full on SunOS 4.1.4

3. Mixing Apache Name Based Virtual Hosts and SSL Virtual Host

4. Installing RH 6.0 on preexisting partitions.

5. Need help with Apache 1.0.0 and Virtual Hosts.

6. Anyone here wants to crack at a problem? This could be good.

7. Need Help with Virtual Hosting @ Linux @ apache

8. how does solaris lock passwd and shadow file?

9. Need help: virtual hosts RH 7.1 / Apache 1.3

10. Need help in virtual hosting with Apache

11. I need some help with apache and virtual hosts.

12. Apache virtual host consulting needed

13. Does Apache 1.0 still need virtual IP when I set vitual host ???