Operating System - HP-UX
1753950 Members
7470 Online
108811 Solutions
New Discussion юеВ

HP-Apache Virtual Hosts on HP-UX

 
SOLVED
Go to solution
Raj_112345
Occasional Advisor

HP-Apache Virtual Hosts on HP-UX

Hi,

I want to configure HP-Apache for 3 sites using Virtual Hosts.
Say the sites are www.abc1.com, www.abc2.com and abc3.com ?

Can someone suggest me how to configure these ?

Thanks in advance,
Raj
4 REPLIES 4
Jeeshan
Honored Contributor
Solution

Re: HP-Apache Virtual Hosts on HP-UX

Hi Raj

A. Setting up the system hosting Apache webserver.
There are two ways.
(i) Without changing DNS entries:
Edit the file /etc/hosts
Change:
192.168.1.1 yourserver yourserver.com
127.0.0.1 localhost loopback
To:
192.168.1.1 yourserver yourserver.com
192.168.1.1 foo www.abc2.com
192.168.1.1 bar www.abc3.com
127.0.0.1 localhost loopback
Edit the file /etc/nsswitch.conf
Change:
hosts: dns files
To:
hosts: files [NOTFOUND=continue] dns
The above will allow the system to look at your /etc/hosts file first for any machine-name and if it wasn't found there, lookup using the DNS.
(ii) Changing DNS entries
Edit your DNS lookup table to add:
192.168.1.1 foo www.abc2.com
192.168.1.1 bar www.abc3.com
B. Setting up the Apache webserver for name based virtual hosting on the same IP address.

In the file /opt/hpws/apache/conf/httpd.conf go to ├в Section 3: Virtual Hosts├в .
Add the following:
NameVirtualHost 192.168.1.1


DocumentRoot /opt/hpws/apache/htdocs-foo
ServerName www.abc2.com



DocumentRoot /opt/hpws/apache/htdocs-bar
ServerName www.abc3.com

To test the configuration enter
/opt/hpws/apache/bin/httpd -t -D DUMP_VHOSTS
You should see the text:
VirtualHost configuration:
192.168.1.1:80 is a NameVirtualHost
default server www.abc.com (/opt/hpws/apache/conf/httpd.conf:1299)
port 80 namevhost www.abc2.com (/opt/hpws/apache/conf/httpd.conf:1299)
port 80 namevhost www.abc3.com (/opt/hpws/apache/conf/httpd.conf:1304)
a warrior never quits
Raj_112345
Occasional Advisor

Re: HP-Apache Virtual Hosts on HP-UX

In case i want to use different IPs then how to configure ?

-Raj
Yogeeraj_1
Honored Contributor

Re: HP-Apache Virtual Hosts on HP-UX

hi Raj,

The DNS or /etc/hosts should normally take care of the IP addresses. As far as possible use names and nothing to worry about in the configuration file ( /opt/hpws/apache/conf/httpd.conf )

Hope Ahsan ustad agrees with me...

hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
YAQUB_1
Respected Contributor

Re: HP-Apache Virtual Hosts on HP-UX

Hi Raj,

Could U pls see the below URL site, I think so it will help full for U:-
http://www.hp.com/products1/unix/webservers/apache/faqs/

Thanks--Yaqub
I am a Customer Advocate!!!