Setting up Name-Based Virtual Hosts with Apache in RH7

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by Richard Balfou » Thu, 23 Nov 2000 04:00:00



Hi All,

I need some help to configure my Red Hat 7 server to support name-based
virtual hosting for two web domains, using Apache 1.3.12 (bundled with RH7).
I have only one IP address which is dynamically allocated.  I have tried the
following in my httpd.conf file:

NameVirtualHost *

<VirtualHost *>
ServerName www.foo.com
DocumentRoot /home/foo/html
...
</VirtualHost>

<VirtalHost *>
ServerName www.bar.com
DocumentRoot /home/bar/html
...
</VirtualHost>

When I restart Apache after making these changes both www.foo.com and
www.bar.com end up going to the same document root.  The server does not
process the requests to their respective directories.
I've tried in vain to use the samples given at Apache's website for how to
setup name-based virtual hosting, but it does not work.  As for my web
browser, it is HTTP 1.1 compliant and it is enabled, as required.

Thanks for any help you can provide.

Regards,
Richard

 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by David K. Mean » Thu, 23 Nov 2000 04:00:00


  Well, the dynamically-allocated IP address does pose a bit of a problem,
but you might be able to get around it.  I don't see anywhere in the Apache
documentation that it says that the <VirtualHost> directive will accept a
"*"
as the argument.  As I read it, that field needs to either be an address or
a
Fully-Qualified-Domain-Name (FQDN).  Since your IP address is not constant,
it will be a real pain to edit the config file each time you get a new
address.  So
I would try putting in the *full* name of your machine after the VirtualHost
keyword.
  Making this work will pose some additional troubles:
  1. you will have to be sure that your name service can resolve the given
name,
or else you will not be any better off than before.  If you have DHCP up and
working
right, I think it will inform your named when a new IP address is assigned.
  2. if you expect that *outside* users will be able to access the web
server
in this situation, you will need to deal with some service like Dynamic DNS,
to
inform the rest of the Internet of the (current) IP address for all of your
hosted
domains.


Quote:> I need some help to configure my Red Hat 7 server to support name-based
> virtual hosting for two web domains, using Apache 1.3.12 (bundled with
RH7).
> I have only one IP address which is dynamically allocated.  I have tried
the
> following in my httpd.conf file:

> NameVirtualHost *

> <VirtualHost *>
> ServerName www.foo.com
> DocumentRoot /home/foo/html
> ...
> </VirtualHost>

> <VirtalHost *>
> ServerName www.bar.com
> DocumentRoot /home/bar/html
> ...
> </VirtualHost>

> When I restart Apache after making these changes both www.foo.com and
> www.bar.com end up going to the same document root.  The server does not
> process the requests to their respective directories.
> I've tried in vain to use the samples given at Apache's website for how to
> setup name-based virtual hosting, but it does not work.  As for my web
> browser, it is HTTP 1.1 compliant and it is enabled, as required.


 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by Richard Balfou » Fri, 24 Nov 2000 09:47:47


Actually, I got it working!  Appearantly, name-based virtual hosting using a
dynamic IP only works with Apache 1.3.14-3, which I upgraded to from Red
Hat's site.

Everything is alive and well!

Now I have to get Sendmail and FTP to work with virtual hosting (:

Regards,
Richard



>   Well, the dynamically-allocated IP address does pose a bit of a problem,
> but you might be able to get around it.  I don't see anywhere in the
Apache
> documentation that it says that the <VirtualHost> directive will accept a
> "*"
> as the argument.  As I read it, that field needs to either be an address
or
> a
> Fully-Qualified-Domain-Name (FQDN).  Since your IP address is not
constant,
> it will be a real pain to edit the config file each time you get a new
> address.  So
> I would try putting in the *full* name of your machine after the
VirtualHost
> keyword.
>   Making this work will pose some additional troubles:
>   1. you will have to be sure that your name service can resolve the given
> name,
> or else you will not be any better off than before.  If you have DHCP up
and
> working
> right, I think it will inform your named when a new IP address is
assigned.
>   2. if you expect that *outside* users will be able to access the web
> server
> in this situation, you will need to deal with some service like Dynamic
DNS,
> to
> inform the rest of the Internet of the (current) IP address for all of
your
> hosted
> domains.



> > I need some help to configure my Red Hat 7 server to support name-based
> > virtual hosting for two web domains, using Apache 1.3.12 (bundled with
> RH7).
> > I have only one IP address which is dynamically allocated.  I have tried
> the
> > following in my httpd.conf file:

> > NameVirtualHost *

> > <VirtualHost *>
> > ServerName www.foo.com
> > DocumentRoot /home/foo/html
> > ...
> > </VirtualHost>

> > <VirtalHost *>
> > ServerName www.bar.com
> > DocumentRoot /home/bar/html
> > ...
> > </VirtualHost>

> > When I restart Apache after making these changes both www.foo.com and
> > www.bar.com end up going to the same document root.  The server does not
> > process the requests to their respective directories.
> > I've tried in vain to use the samples given at Apache's website for how
to
> > setup name-based virtual hosting, but it does not work.  As for my web
> > browser, it is HTTP 1.1 compliant and it is enabled, as required.

 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by Santosh Kumar Pas » Fri, 24 Nov 2000 04:00:00


Use following configurations ....

/etc/hosts

127.0.0.1   localhost.localdomain localhost
127.0.0.1   www.foo.com
127.0.0.1   www.bar.com

==================================

/etc/httpd/conf/httpd.conf add following lines at bottom of this file

NameVirtualHost 127.0.0.1

<VirtualHost www.foo.com>
ServerName www.foo.com
DocumentRoot /home/foo/html
</VirtualHost>

<VirtualHost www.bar.com>
ServerName www.bar.com
DocumentRoot /home/bar/html
</VirtualHost>

Regards,
Santosh Kumar Pasi
==================================


> Hi All,

> I need some help to configure my Red Hat 7 server to support name-based
> virtual hosting for two web domains, using Apache 1.3.12 (bundled with
RH7).
> I have only one IP address which is dynamically allocated.  I have tried
the
> following in my httpd.conf file:

> NameVirtualHost *

> <VirtualHost *>
> ServerName www.foo.com
> DocumentRoot /home/foo/html
> ...
> </VirtualHost>

> <VirtalHost *>
> ServerName www.bar.com
> DocumentRoot /home/bar/html
> ...
> </VirtualHost>

> When I restart Apache after making these changes both www.foo.com and
> www.bar.com end up going to the same document root.  The server does not
> process the requests to their respective directories.
> I've tried in vain to use the samples given at Apache's website for how
to
> setup name-based virtual hosting, but it does not work.  As for my web
> browser, it is HTTP 1.1 compliant and it is enabled, as required.

> Thanks for any help you can provide.

> Regards,
> Richard

--
Posted via CNET Help.com
http://www.help.com/
 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by hughjones.. » Sat, 25 Nov 2000 04:00:00


Hi,

We have two computers connected via their Ethernet cards, and are trying to
make them talk to each other. We hope you can help!

Both kernels are correctly configured (automatically detected by Mandrake)
and we have set up the interfaces as follows:

I am "192.168.0.1" and the other computer is "192.168.0.2". (We configured
ourselves via linuxconf)

We have both done
route -add 192.168.0.0 eth0

The output of "route" for me is:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
demon-du.demon. *               255.255.255.255 UH    0      0        0 ppp0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         demon-du.demon. 0.0.0.0         UG    0      0        0 ppp0

The output of ifconfig for me is:

]# ifconfig
eth0      Link encap:Ethernet  HWaddr 52:54:05:E2:F9:BE
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:231 dropped:0 overruns:0 carrier:462
          collisions:3927 txqueuelen:100
          Interrupt:9 Base address:0xe000

For the other computer, the results for route as follows.

netstat -rn
Destination     Gateway       Genmask       Flags  MSS Window irtt IFace
192.168.0.2     0.0.0.0      255.255.255.255    UH      0     0     0   eth0
192.168.0.0     0.0.0.0.     255.255.255..0      U       0     0     0   eth0
127.0.0.0       0.0.0.0      255.0.0.0           U       0     0     0    lo
0.0.0.0         192.168.0.1   0.0.0.0            UG      0     0     0   eth0

Our problem is that we can't make the computers even recognise each other's
IP address: pinging each other via 192.168.0.1 (or 2) or the broadcast
address 192.168.0.255 doesn't work. Nor can we telnet, etc.

We would like to know what steps we ought to take to troubleshoot. We've read
the Networking Howto (ex Net-3-Howto) and the Linux Network Administrator's
Guide, but are still at a loss.

Thanks!
David Hugh-Jones

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by Steve Housem » Sun, 26 Nov 2000 04:00:00


Quote:> ]# ifconfig
> eth0      Link encap:Ethernet  HWaddr 52:54:05:E2:F9:BE
>           inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:231 dropped:0 overruns:0 carrier:462

                                ^^^                              ^^^
Quote:>           collisions:3927 txqueuelen:100

                       ^^^^            

Quote:>           Interrupt:9 Base address:0xe000

Your problem is shown by the collisions ... you have not sent
a single packet successfully ... I know zilch about the hardware
side of it esp hubs (I have thin ethernet) , but I would guess
that you have used a direct cable instead of a crossover cable
(or is that vv?) .

Hope you fix it soon,

Steve Houseman

--

currently  steve.houseman at * net      

 
 
 

Setting up Name-Based Virtual Hosts with Apache in RH7

Post by M. Buchenried » Sun, 26 Nov 2000 04:00:00


[...]

Quote:>]# ifconfig
>eth0      Link encap:Ethernet  HWaddr 52:54:05:E2:F9:BE
>          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:0 errors:231 dropped:0 overruns:0 carrier:462

                         ^^^^^^^^^                       ^^^^^^^^^^

[...]

Youre either using the wrong settings, or no hub and no crossover
cable. Or the cable is broken.
Check

- that youre using a crossover cable if no hub is installed
- that the cable is OK
- that both cards use half-duplex (without hub)

Michael
--

          Lumber Cartel Unit #456 (TINLC) & Official Netscum
    Note: If you want me to send you email, don't munge your address.

 
 
 

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

This query refers to Apache 1.3.24 and mod_ssl 2.8.8-1.3.24, on
Solaris 8.

I am running a bunch of name-based virtual hosts on port 80 using a
wildcard in the NameVirtualHosts directive. I am load balancing across
a lot of real servers and want to have the same config files on each
server, so I don't want to have to specify the server IP address in
httpd.conf.

I now want to add an SSL virtual host on port 443. I know that I can't
have name-based virtual hosts with SSL, and I don't need them -- I
just need the one. But if I try to add a virtual host configuration
like:

<VirtualHost _default_:443>
    [SSL configuration stuff]
</VirtualHost>

I get the error message "mixing * ports and non-* ports with a
NameVirtualHost address is not supported, proceeding with undefined
results".

Is there any other way I can have several name-based virtual hosts on
port 80, a single SSL virtual host on port 443 and not have to put the
server IP address in httpd.conf?

2. trusted solaris 8

3. Setting up IP-based and Name-based virtual hosting side by side...

4. test post

5. Name-based vs IP based virtual hosts

6. Soulborne

7. Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

8. best editor for linux?

9. Apache name-based virtual hosts

10. Mixing IP-based and name-based virtual hosts?

11. Apache 1.3b3 Name-Based Virtual Host Problems

12. Can IP-based and Name-Based Virtual Hosting coexist

13. name-based virtual hosting in apache