[lug] ifconfig/apache -- 2 ips, 2 domain names

Hugh Brown hugh at math.byu.edu
Tue Oct 18 09:12:47 MDT 2005

> I read about name-based virtual hosting in Apache, and IP-based
> virtual hosting.  In fact there is a GUI config tool in Fedora that
> does that for you.  However, I need to, put some ifconfig commands
> into /etc/rc.d/rc.local/ in order to have this box recognize the new
> name/ip.  I don't know what kind of configuration this is -- does it
> have a name?  And would I use a name-based or ip-based virtual host
> container?
> Right now I have an IP tied to dijon.colorado.edu.  HTTP requests to
> dijon look in /var/www/html/.  Now the IT people have set up DNS to
> connect a new, different ip number to a new name, bike.colorado.edu.
> I would like requests to bike.colorado.edu/ to point to
> /var/www/html/bike/.  I don't have the ifconfig set up properly.
> Actually it isn't set up at all.  Can anyone show or point me to an
> example of what I should write in /etc/rc.d/rc.local/, or provide me
> with a name for this kind of configuration, if it has a special name?
> Thanks in advance,
> Dave

There are a few different ways to accomplish what you are doing.  First,
you need to get your linux box listening for the IP tied to

I'm not sure how to use the gui to do it, but from the command line:

cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0:0

now edit ifcfg-eth0:0 and change the DEVICE line to read

and edit the IPADDR line to have the correct ip address

Now, do "service network start" and the machine should start listening on
that ip address.

As for apache, I believe you can add a section like this for your
bike.colorado.edu website:

	ServerName bike.uiowa.edu
        ServerAdmin  david.kritzberg at colorado.edu
	CustomLog logs/bike.colorado.edu
	ErrorLog  logs/bike.colorado.edu_error
	DocumentRoot /var/www/bike/html

as a starting point.

You probably don't want to mix dijon and bike's DocumentRoot.  So I'd
leave dijon in /var/www/html and create /var/www/bike/html for bike


More information about the LUG mailing list