old-www/HOWTO/Virtual-Web/setup.html

646 lines
11 KiB
HTML

<HTML
><HEAD
><TITLE
>How Do I set it up?</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="Virtual Web mini-HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="What Software and Software Patches Do I Need?"
HREF="patches.html"><LINK
REL="NEXT"
TITLE="Links to More Virtual Web Information"
HREF="links.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Virtual Web mini-HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="patches.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="links.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="SETUP"
>4. How Do I set it up?</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="NEW-ACCOUNT"
>4.1. Create the New Account</A
></H2
><P
> Create a regular Linux account for the virtual customer with home
directory and mail.
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="HTTP-SETUP"
>4.2. NCSA 1.5 or Apache Config Files</A
></H2
><P
> Virtual Host implementations are still changing. A few patches
exist to support Virtual Host Check the server's release notes for
more details. NCSA 1.5 or Apache now include the Virtual patches,
and I have been told that Spinner supports virtual hosts.
</P
><P
> One virtual patch supports the following srm.conf syntax, however
the second NCSA 1.5 method of defining a Virtual host allows
for greater flexibility
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>SubDocumentRoot www.domain1.com /usr/local/etc/httpd/docs/domain1
SubDocumentRoot www.domain2.com /usr/local/etc/httpd/docs/domain2</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> NCSA and Apache support the following httpd.conf syntax:
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>ServerAdmin webmaster@domain1.com
DocumentRoot /usr/local/etc/httpda/docs/domain1
ServerName www.domain1.com
ErrorLog logs/errors.domain1.com
TransferLog logs/access_log.domain1.com</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="INTERFACE"
>4.3. Configuring the interface</A
></H2
><P
> Once the IPalias patches have been installed add the
following to your /etc/rc.d/rc.local on your local web server.
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>/sbin/ifconfig eth0 alias www.domain1.com
/sbin/ifconfig eth0 alias www.domain2.com
/sbin/ifconfig eth0 alias www.domainN.com</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="INTERNIC"
>4.4. Registering with Internic</A
></H2
><P
> If you are setting up a new domain or change a current
domain, you must register the domain with Internic.
The template can be found at
ftp://rs.internic.net/templates/domain-template.txt
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="NAMED"
>4.5. Configuring Named</A
></H2
><P
> Named will need to be configured so that your virtual domain will
be visible to the outside world. I don't claim to be an expert
on DNS. Suggestions always welcome.
</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="NAMED-EX-1"
>4.5.1. Example /etc/named.boot</A
></H3
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>directory /etc/named.data
primary realdomain.com db.realdomain.com
primary xxx.xxx.xxx.IN-ADDR.ARPA db.xxx.xxx.xxx
primary 0.0.127.IN-ADDR.ARPA db.local
primary domain1.com db.domain1.com
primary domain2.com db.domain2.com
cache . named.root</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> <DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Replace x with your IP.
</P
></TD
></TR
></TABLE
></DIV
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="NAMED-EX-2"
>4.5.2. Example /etc/named.data/db.domain1.com</A
></H3
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>$ORIGIN com.
domain1 IN SOA domain1.com. hostmaster.domain1.com. (
10134 43200 3600 604800 86400 )
IN NS ns1.realdomain.com.
IN MX 10 mail.realdomain.com.
IN MX 0 domain1.com.
domain1.com. IN A xxx.xxx.xxx.xxx ;www.domain1.com IP
$ORIGIN domain1.com.
ftp IN CNAME domain1.com.
www IN CNAME domain1.com.
mail IN CNAME domain1.com.</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="NAMED-EX-3"
>4.5.3. Example /etc/named.data/db.xxx.xxx.xxx</A
></H3
><P
> You should already have a db.xxx.xxx.xxx for your current site
update it to contain the new virtual domains for reverse lookups
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>xx IN PTR www.domain1.com.
xx IN PTR www.domain2.com.</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="NAMED-RESTART"
>4.5.4. Restart named</A
></H3
><P
> Once you've finished editing config files, you will need to
restart the named daemon.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="MAIL"
>4.6. Virtual Mail</A
></H2
><P
> Your virtual customers will more than likely want the ability to have
mail that is sent to their domain forwarded to another domain. A few
sendmail.cf changes will do the trick. After several months of
trying different sendmail changes, this is the 1st method that I
found that works and requires only one sendmail.cf change for each
new virtual site.
</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="SENDMAIL"
>4.6.1. Sendmail Configuration</A
></H3
><P
></P
><OL
TYPE="1"
><LI
><P
> Retrieve the current version of sendmail that contains makemap btree support.
</P
></LI
><LI
><P
> Create a file called /etc/domainalias with the following mappings:
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>*@domain1.com localnet@realdomain.com
*@domain2.com townplaz@realdomain.com
*@domainN.com soracomp@realdomain.net
webmaster@domain1.com somuser@anotherhost.com
jamison@domain2.com anotheruser@somehost.com</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
> Create the maped DB file
</P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>makemap btree /etc/domainalias.db &#60; /etc/domainalias</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
> /etc/sendmail.cf changes:
</P
><P
></P
><OL
TYPE="a"
><LI
><P
> Add a Cw record for each new virtual host
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>Cwdomain1.com
Cwdomain2.com</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
> Add the domainalias mapping only once.
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>Kdomainalias btree /etc/domainalias.db</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
> Add/Change Ruleset 98
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>###################################################################
### Ruleset 98 -- local part of ruleset zero (can be null) ###
###################################################################
S98
R$+ &#60; $+ . &#62; $1 &#60; $2 &#62; remove trailing dots
R$+ &#60; $+ &#62; $: &#60; &#62; $(domainalias $1$2 $) match user@address
R&#60; &#62; $+ @ $* $: &#60; $1 &#62; $(domainalias * @ $2 $) match *@address
R&#60; $+ &#62; * $* $: &#60; &#62; $1 $2 replace * with userid
R &#60; $+ &#62; $+ $: &#60; &#62; $2 bugfix
R&#60; &#62; $* $: $&#62;3 $1 and rewrite using S3</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
></OL
></LI
><LI
><P
> Sendmail Testing
</P
><P
> Test the sendmail configuration to verify the new sendmail.cf changes
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>sendmail -v -bv info@domain1.com</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> The final destination should be displayed.
</P
></LI
></OL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="FTP"
>4.7. Virtual FTP</A
></H2
><P
> Currently, I have not been able to get Virtual FTP to work.
A few patches exist, and I'm sure a working patch exist.
We just create a working directory /home/ftp/business/domain1,
but a true Virtual FTP would be nice.
</P
><P
> If anyone would like to contribute a solution, I would be more
than happy to add it here.
</P
><P
> Arnt Gulbrandsen has rewritten ftpd and has included support for
independent FTP services The Troll Tech FTP Daemon
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="patches.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="links.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>What Software and Software Patches Do I Need?</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Links to More Virtual Web Information</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>