SUMMARY: 1 Web Server - Multiple Names

From: Mark Belanger (
Date: Thu Dec 12 1996 - 14:19:17 CST

Great Responses, thank you all. This summary is quite lenghty.
I will give the short answers, but still include all replies
for posterity. If anyone has ever wanted to set up their web server
this way,,this mail contains all the info you'll need.

> I have a SparcUltra running Sol2.5 as my web server
> running NCSA HTTPd NCSA/1.5.2
> I would like to configure it so that it could be accessed by
> different names and display a web page determined by what name
> it is called by.

SOLUTION: The only way to do it is to configure multiple interfaces
           on your web server and use the VirtualHost feature of the
           server software. A number of people recommended switching
           to Apache's web server. I've had no problems with NCSA so
           I stuck with it.
  **NOTE: This worked for my application - an intranet web server.
    By reading through all the replies I got, you may find more
    in depth and useful information.

1 I selected the address as my additional ip address and
   had it added to the NIS hosts map
2. Added the following entry to httpd.conf:
        DocumentRoot /user/eng_web/pdeng
        ServerName pdeng
        ResourceConfig /user/eng_web/http/conf/pdeng.conf
        ErrorLog logs/pdengerror_log
        TransferLog logs/pdengaccess_log
        AgentLog logs/pdengagent_log
        RefererLog logs/pdengreferer_log
3. Created a conf file for pdeng (See ResourceConfig above)
   For this all I did was copy my srm.conf to pdeng.conf and altered the
   Following entries:
        DocumentRoot /user/eng_web/pdeng

Now I got the new ip address working
4. Create /etc/hostname.le0:2 which contains
5. Set up the new interface
   # ifconfig le0:2 up
6. # ping is alive
7. Restart the web server and all is working.

Special Thanks to Clay Irving, Chad Adams, Daniel Beaudry and
  Jochen Bern. Their information was so complete, that it couldn't
  have been easier to setup unless they came over and did it for me :)
Clay Irving <>
Chad Adams <>
Daniel Beaudry <>
Jochen Bern <>
Dan Pritts <>
Marcelo Maraboli <>
Alex Finkel <> (Christian Masopust)
 "Matthew J. Hill" <>
"Feeney, Tim" <>
Richard Snyder <>
"Brian T. Wightman" <>
"Alfredo Sola" <>
Kent Clarstroem <>
Kevin Davidson <>
Charles Gagnon <charles@Grafnetix.COM>

Clay Irving <>
I'll walk you through an example:

Let's say your system has an IP address of and you want
to configure

ifconfig le0:1 up

This brings the interface up immediately, but you'll want to bring it up
on reboot -- In /etc create a file called hostname.le0:1 -- the content
the file is:

Ping the new IP address. If it's alive, configure your Web server.

Et voila!

Chad Adams <>
 I run an NCSA web server currently running 8 alternate IP addresses
and serving 9 different web "sites". It works quite excellent,
actually. If
you have the IP addresses to spare, I would recommend it. It's actually
very easy to set up. I'll enclose my config files:


ifconfig le0
ifconfig le0:30 netmask
ifconfig le0:31 netmask
ifconfig le0:32 netmask
ifconfig le0:33 netmask
ifconfig le0:34 netmask
ifconfig le0:35 netmask
ifconfig le0:36 netmask
ifconfig le0
ifconfig le0:30
ifconfig le0:31
ifconfig le0:32
ifconfig le0:33
ifconfig le0:34
ifconfig le0:35
ifconfig le0:36 up

httpd.conf :


that's it! Reboot the machine (or just execute the rc2.d script) and
all set. I hope this helps, let me know if you need more info.

        Chad Adams

Daniel Beaudry <>
Create a new file called /etc/hostname.le0:X, X beeing the last in
sequence number of /etc/hostname.le files. Write in the name of the
new web site. Like: In /etc/hostname.le0:2 We have:

Modify the file /var/dns/db.Your.C.Class_address

Add the new IP address for this virtual web site Example:
4 IN PTR ; Sparc 5, le0:2
Dont forget to change the DNS version file

Create a file /var/dns/db.DOMAINE_NAME
In fact, you can copy your primary db.domain_name and modify it to
reflect the settings for the new domain. Dont forget to change the
DNS version file

Add a new entry in /var/dns/named.boot to look like this:
primary db.dimalt

Add the entry for this virtual web site in /etc/inet/hosts to look like

Tell the named there are changes in config files.
ps -ef |grep named Remember process ID of named
Kill -HUP processid

Enable the new address in the kernel ex:
ifconfig le0:2 -trailers up

Configure the Web server for the new virtual site.
Create a directory for this new site
Modify the file /opt/local/httpd/conf/httpd.conf
Here is a truncated sample of my file:

<VirtualHost Required>
ResourceConfig conf/srm.conf
DocumentRoot /home/http/dimalt

Add a index.html page in the directory of the new virtual site

Stop and restart the web server
/etc/init.d/httpd stop
/etc/init.d/httpd start

Test it from your prefered browser.
Daniel Beaudry
Jochen Bern <>
It's the ONLY Way. The Request comes with a Server IP# and a Server
Port Number tagged onto it, NOT a (supposed) Server Name, and having
httpd listen to several Ports simultaneously is hard to program while
having it listen to Port X "on any IP# considered local" is trivial.

My virtual WWW Server isn't currently visible from the Outside (cause
our central Router's Admin is a Dork :-{ ), but I *have* two Servers
running on the same Machine (Solaris 2.4) and can vouch that it's
simple to set up. Look:

zeus:/home/bern% cat /etc/rc2.d/S99local
# start/stop the local stuff

case "$1" in
        if [ -x /pub/etc/httpd ]; then
                /usr/sbin/ifconfig le0:1 up netmask + \
                        broadcast + -trailers
        for DAEMON in /pub/etc/httpd ; do
                PID=`/usr/bin/ps -ef | grep $DAEMON | awk '{print $2}'`
                if [ ! -z "$PID" ] ; then
                        /usr/bin/kill ${PID} 1> /dev/null 2>&1
exit 0
zeus:/pub/etc/httpd-config% tail -20 httpd.conf | head -10
<VirtualHost Required>
DocumentRoot /pub/public/WWW/static/WEP
ServerName WWW.WEP.Uni-Trier.DE
ResourceConfig httpd-config/WEP-srm.conf
ErrorLog /pub/Logs/httpd/WEP/error_log
TransferLog /pub/Logs/httpd/WEP/access_log
AgentLog /pub/Logs/httpd/WEP/agent_log
RefererLog /pub/Logs/httpd/WEP/referer_log

zeus:/pub/etc/httpd-config% diff srm.conf WEP-srm.conf
< DocumentRoot /pub/public/WWW/static/Root

> DocumentRoot /pub/public/WWW/static/WEP
< UserDir public_html
> UserDir public_html_WEP
< ScriptAlias   /cgi-bin/       /pub/public/WWW/bin/Root/cgi-bin/
> #ScriptAlias  /cgi-bin/       /pub/public/WWW/bin/Root/cgi-bin/

(That last Change prevents CGI-bins on; There are currently none installed, so I prefer to have the whole Thing disabled.)

R ******************************************************************************** Dan Pritts <>

My understanding is that configuring it for multiple IP addresses is the only way to do this. The system has no way of knowing what the requested hostname was when the query comes in, by that time it has been translated to an IP number.

If you give it multiple IP numbers then it does have a way of knowing.

I've talked to folks who've done this with solaris with no problems. ******************************************************************************** Marcelo Maraboli <> I have multiple name to different pages in the single server using NCSA 1.5.2a HTTPD using virtual hosts.

you need to have the multiple IP on the single ethernet card using /etc/hostname.le0:1 /etc/hostname.le0:2 and so on..

you put this new IP in an DNS wit antoher name, ie,

and configure the virtual host on httpd.conf and creat a new_srm.conf file for each virtual host.

works fine for me.. ******************************************************************************** Alex Finkel <> I don't use NCSA httpd, but I would have recommended using virtual IP addresses. The capability is built into Solaris, so I wouldn't have any reservations about using it. Each virtual interface would have it's own name which would be it's fully qualified name and not simply an alias.

The only possible drawback is if you are running short of IP addresses on the server's segment. Also, if you use Legato Networker/Solstice Backup I have heard of folks getting license errors but otherwise it should not cause any problems.

- Alex

******************************************************************************** (Christian Masopust) I don't know much about NCSA-httpd (if it really supports VirtualHosts), but try to use Apache! It's really great, configuration is as easy as NCSA and it really supports VirtualHost.

If you can't figure it out with the Apache-documentation ( send me a mail and I'll give you my configuration files... ******************************************************************************** "Matthew J. Hill" <> i do not believe NCSA httpd has this capability, though the feature may well have been added since i last checked. you will want to use apache httpd anyway, it is a much better product in any case. the VirtualHost _is_ the correct way to do this procedure, and, unless i am mistaken, the only way. what you want to do, after all, is set up virtual hosts, right? one machine that will answer to multiple names and appear to 'be' more than one machine, by providing different web pages to each one. you will, also, need to provide a separate IP address for each name you have, and set up your machine to answer to all of the addresses. that is how the web daemon will know which address the hit is coming from. else, if you have all the names pointing to the same IP address, it will think all the hits are coming to the same name (only the IP address is passed to the machine when a connection is made.) ******************************************************************************** "Feeney, Tim" <> Not sure why you are not comfortable with the multiple ip addresses, it is quite easy to setup on Solaris. The problem that you run into with the same IP address but different names is that the tcp/ip packets only have the ip address as an identifier. So when you look up the ip address you will always get the same name (ie. gethostbyaddr() will always return sandia). Look in the FAQ regarding setting up the multiple IP addresses for one card. This is the only way that I am aware of to perform what you need, and how you need it. ******************************************************************************** Richard Snyder <> If you're not stuck on using NCSA I'd suggest using Apache ( instead. The virtual hosting is quite easy to set up. You will have to use a different IP for each of the virtual servers. Use multiple hostname.le0, hostname.leo:1, etc files to allow the machine to listen for multiple IPs. The documentation that comes with Apache should be self explanatory. If you have any other questions or I was too vague, I'd be happy to help. ******************************************************************************** "Brian T. Wightman" <> I think virtual hosts might be the way you want to go. You set up:

ifconfig le0:1 up netmask + broadcast +

for each virtual address you want to have show up. The "1" in the above example should be changed to a unique number for each interface. ******************************************************************************** "Alfredo Sola" <> Either configure multiple IP addresses, which is the standard method, or use a Netscape server, in which case only Netscape clients (not sure about M$'s IExplore) would see the second and further servers.

My machine has multiple addresses and works just fine. I'm using DNS. Feel free to e-mail me for more info. ******************************************************************************** Kent Clarstroem <> You should try Roxen (, it will give you many times the speed you currently have, use less memory (which in the end means even more speed, as you get more memory for OS buffers), provide multihosting in a simple and innovative way with html-setup, use your current cgi-bin's and imagemaps without any changes and last but not least, IT'S FREE!

If you have any questions, please, don't hesitate to ask! ******************************************************************************** Kevin Davidson <> Each name must have a separate IP address. You can't do it with a single IP address. Virtual addresses under Solaris are easy. Just pick another couple of IP addresses on the same subnet and ifconfig them up.

eg if your IP address is and your netmask is then you could do ifconfig le0:1 address up ifconfig le0:2 address up

and your host will now respond to all three IP addresses. Give each one a different name in your DNS and hosts tables. Put those names in the appropriate /etc/hostname.{le0,le0:1,le0:2} file to automate this at reboot.

******************************************************************************** Charles Gagnon <charles@Grafnetix.COM> I think the virtual host method is not only the *proper* method but the *only* method also.

The setup is not only done thru HTTPD though, you need to setup something like VIF to allow your machine to hld more than one IP address.

-- Mark Belanger Software Technician * Email : * LTX Corporation * Voice : (617) 467-5021 * LTX Park at University Ave * Fax : (617) 329-6880 * Westwood, MA 02090-2306, USA

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:18 CDT