Virtual Hosting

The following are the processes I used to get implement Virtual Hosts on my Qube 2. I first implemented IP Based Virutal Hosts and then Name Based Virtual Hosts. I ended up using the Name Based Virtual Hosts because it made the implementation of the ipfwadm firewall easier. These procedures were typed up after a few iterations. I tried to accurately capture the streamlined process but there may be typos and other nuances for your specific setup. I would be happy to implement any corrections and or additions to this description.

IP Based Virtual Hosts

Set Up Your Network IP Addresses

cd /etc/sysconfig/network-scripts

Create a file for each IP address you want to configure named ifcfg-eth1:{0,1,2...n} with the following:

DEVICE=eth1:0
ONBOOT=yes
IPADDR=216.101.175.82
NETWORK=216.101.175.80
NETMASK=255.255.255.248
BROADCAST=216.101.175.87
ALIAS=yes
BOOTPROTO=none

Update the DEVICE, IPADDR, NETWORK, NETMASK, and BROADCAST lines as appropriate for your network.

Start up the interface(s) (only required once for the current running system).

/etc/sysconfig/network-scripts/ifup eth1:0

To ensure these interfaces start properly on boot, edit /etc/rc.d/init.d/network and change the line:

interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$'`

to read:

interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo)' | egrep 'ifcfg-[a-z0-9:]+$'`

Apache IP Based Virtual Hosting

Reference Apache.org

cd /etc/httpd/conf
vi httpd.conf

Add the following to the bottom of the file for each virtual host/IP Address combination you are setting up:

<VirtualHost 216.101.175.82>
DocumentRoot /home/groups/caymangroup
ServerName caymangroup.com
</VirtualHost>

Update the above to use the groupname you created for yourdomain.com using the Cobalt Administrator site. You can optionally add lines for separate log/error files in the VirtualHost specification. If you choose to do that then you should also set up log rotation in /etc/logrotate.d.

Restart the running httpd daemon:

/etc/rc.d/init.d/httpd.init stop
/etc/rc.d/init.d/httpd.init start

Name Based Virtual Hosts

For Name Based Virtual Hosting you only need your primary IP address used for your Qube 2. You will define the domain names that will reference this IP address in the httpd configuration file.

Apache Name Based Virtual Hosting

Reference Apache.org

cd /etc/httpd/conf
vi httpd.conf

Add the following to the bottom of the file for the IP address to be used for the virtual hosts:

NameVirtualHost 216.101.175.82

Then add the following for each virtual host you want associated with this IP address:

<VirtualHost 216.101.175.82>
DocumentRoot /home/groups/caymangroup
ServerName caymangroup.com
</VirtualHost>

Update the above to use the groupname you created for yourdomain.com using the Cobalt Administrator site. You can optionally add lines for separate log/error files in the VirtualHost specification. If you choose to do that then you should also set up log rotation in /etc/logrotate.d.

Restart the running httpd daemon:

/etc/rc.d/init.d/httpd.init stop
/etc/rc.d/init.d/httpd.init start


Send us an email with questions or comments about this website.
Copyright © 2000-2024 CaymanGroup.com. All Rights Reserved.
Last Modified: Tuesday, November 2, 2021 4:19:22 PM