Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 1997 09:38:54 +0100
From:      Gianmarco Giovannelli <gmarco@scotty.masternet.it>
To:        questions@freebsd.org
Subject:   Re: Virtual Servers on FreeBSD
Message-ID:  <3.0.1.32.19970313093854.0077d470@scotty.masternet.it>

next in thread | raw e-mail | index | archive | help
At 23.22 11/03/97 +0000, you wrote:
>Help..I am running FreeBSD and an Apache Web Server.  I currently have the
>OS and
>Apache Web Server working.  My problem is that I am now trying to configure
>an additional domain to the web server...a virtual server.  Does anyone have
>any help to offer in configuring the FreeBSD files with the Apache Server to
>create virtual servers?
>


I am not an unix guru , but I saved a couple messages about this :-)
I hope they could help you...




>>On Fri, 25 Oct 1996, Jack Wenger wrote:
>>
>>> Hi!
>>> I just got the Sys-Admin job dumped on me. (ye ha) I'm not very
>>> knowledgeable in the mysteries of FreeBSD and Apache, so I need some help.
>>> We've got a pentium 133 w/ 64 Mb co-located at a local ISP (Madison, WI).
>>> We're running FBSD 2.1.0 and Apache 1.1.0. I need to host virtual
domains on
>>> this box, and have yet to find a lucid explaination how to do this.
>>
>>First, get a spare box to play with, and practice upgrading.  Both your
>>version of FreeBSD and Apache are out of date.
>>
>>
>>> After
>>> doing an exhaustive search, I can't find an understandable description.
>>> Would somebody please write (or point me to) me a fairly detailed, step by
>>> step procedure? I'll be getting IP's from our ISP (they use BSDI, so
that's
>>> not a problem. I do know how to add users and I'm running sendmail and
that
>>> popper thang.
>>> Thanx!
>>
>>Funny you should ask, I'm working on a how-to web site for setting up web
>>servers, but I haven't made it as far as the virtual stuff.  Really
>>simple, though.
>>
>>First, you need to set up an aliased IP address.  if you're connected to
>>ethernet, you can simply add a line to /etc/rc.local that looks like this:
>>
>>ifconfig ed0 alias 204.160.242.11 netmask 255.255.255.255
>>
>>Then, you need to add something like this to the srm.conf file (wherever
>>it is located)
>>
>><VirtualHost test.bfd.com>
>>ServerAdmin webmaster@bfd.com
>>ServerName test.bfd.com
>>DocumentRoot /usr/local/www/htdocs/test
>>ErrorLog logs/test.bfd.com-error_log
>>TransferLog logs/test.bfd.com-access_log
>>Alias /index.html /usr/local/www/htdocs/test/root.shtml
>></VirtualHost>
>>
>>where all the locations and such match up, and test.bfd.com is replaced
>>with the name that corresponds to the IP address.
>>
>>
>>



-----


>>   Now, here is the question. Is it possible to set up virtual mail host?
>>   I think if I set Cw record in sendmail.cf, aaa@www.aaa.com and
>>   bbb@www.bbb.com can be handled. My point is that ONE FBSD box can accept
>>   mail for webmaster@www.aaa.com and webmaster@www.bbb.com simutaneously..
>> 
>
>What you will need to do is first modify sendmail.cf to deal with two 
>databases in the /etc directory that will handle the aliasing.
>
>add these two lines to sendmail.cf
>
>Kvirtualhosts btree /etc/virtualhosts.db
>Kvirtualmasqs btree /etc/virtualmasqs.db
>
>add this rule set for the return mail masq
>
>S40
>     
>R$* < @ $* > $*         $@ $1 < @ $2 > $3       already fully qualified
>#bc instead of automatically using $M, lookup masquerade in virtualmasqs
>R$*                     $: $(virtualmasqs $1 $: $1 @ $M $)
>#bcR$*                  $: $1 @ $M              add local qualification
>R$* @                   $: $1 @ $j              if $M not defined
>
>add this rule set for the virtual hosts
>
>S98 
>
>################################
># sendmail for virtual domains #
>################################
>
>R$+ < @ $+  . >         $: $1 < @ $2 > .
>R$+ < @ $+ > $*         $: $(virtualhosts $1@$2 $: $1 < @ $2 > $3 $)
>R$+ < @ $+ > $*         $: $(virtualhosts $2 $: $1 < @ $2 > $3 $)
>R$+ < @ $* > .          $: $1 < @ $2 . >
>
>
>
>for inbound mail:
>
>create /etc/virtualhosts with your favorite text editor, there can be 
>as many lines as you want for each virtual host.
>
>virtdomain.com			john@mydomain.com   (all mail goes to john)
>sam@virtdomain.com		sam@mydomain.com
>webmaster@virtdomain.com	bob@other.domain.com (forward mail to 
>							third system)
>
>create the database virtualhosts.db from virtualhosts with the makemap 
>command (makemap comes with sendmail)
>
>makemap btree virtualhosts.db <virtualhosts
>
>for outbound mail (they need an account on your system)
>create /etc/virtualmasqs (if you use PINE do this in setup)
>
>frank	frank@virtdomain.com
>gloria	gloria@virtdomain.com
>fred	fred@virtdomain.com
>
>create the database virtualmasqs.db from virtualmasqs with the makemap 
>command
>
>makemap btree virtualmasqs.db <virtualmasqs
>
>
>****************************************
>EACH TIME YOU ADD ANOTHER VIRTUAL DOMAIN
>****************************************
>(this is from part of the instructions I give sysop's on our system)
>
>5. Add Cw line in /etc/sendmail.cf
>
>	Cw new.domain.com
>
>6. Add alias to /etc/virtualhosts
>
>	webmaster@new.domain.com	account@real.domain
>
>	run command:
>
>	makemap btree virtualhosts.db < virtualhosts
>
>7. if they have an account on our machine and want mail to look like it 
>is coming from their domain.
>
>	add alias to /etc/virtualmasqs
>
>	username	anyname@new.domain.com
>
>	run command:
>
>	makemap btree virtualmasqs.db < virtualmasqs
>
>8. restart sendmail
>
>	get the pid with
>
>	ps -aux | grep sendmail
>
>	run command:
>
>	kill -HUP sendmail.pid
>

Regards...
Gianmarco ( gmarco@masternet.it )
"Unix expert since 1997"

http://www2.masternet.it/~gmarco       
http://www2.masternet.it/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.1.32.19970313093854.0077d470>