mirror of https://github.com/tLDP/LDP
new entry of formerly unmaintained doc
This commit is contained in:
parent
c5eca15b6d
commit
be1cffb703
|
@ -0,0 +1,463 @@
|
|||
<!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
|
||||
|
||||
<article>
|
||||
<artheader>
|
||||
<title>Virtual Web mini-HOWTO</title>
|
||||
<author>
|
||||
<firstname>Dan</firstname>
|
||||
<surname>Pancamo</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Parag</firstname>
|
||||
<surname>Mehta</surname>
|
||||
<affiliation>
|
||||
<address><email>pm@gnuos.org</email></address>
|
||||
</affiliation
|
||||
</author>
|
||||
|
||||
<othercredit role="converter">
|
||||
<firstname>David</firstname>
|
||||
<surname>Merrill</surname>
|
||||
<contrib>Conversion from text to DocBook SGML.</contrib>
|
||||
</othercredit>
|
||||
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>1.1</revnumber>
|
||||
<date>2001-06-03</date>
|
||||
<revremark>New maintainer, converted to DocBook (SGML), Licensed under GFDL.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.0</revnumber>
|
||||
<date>1995-11-24</date>
|
||||
<revremark>Initial Release.</revremark>
|
||||
</revision
|
||||
</revhistory>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
This HOWTO discuss the essentials of setting up a Virtual Web Site under Linux.
|
||||
</para>
|
||||
</abstract>
|
||||
</artheader>
|
||||
|
||||
<sect1 id="license">
|
||||
<title>License</title>
|
||||
<para>
|
||||
This document is made available under the
|
||||
<ulink url="http://www.gnu.org/copyleft/fdl.html"><citetitle>GNU Free Documentation License.</citetitle></ulink>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="whatis">
|
||||
<title>What is a Virtual Web Site?</title>
|
||||
|
||||
<para>
|
||||
A World Wide Web (WWW) Server is normally a single machine dedicated to
|
||||
processing HTTP requests for a single WWW site. Simply put, one WWW site
|
||||
per machine. Since the computing resources for processing httpd requests is
|
||||
low for most WWW sites, the majority of the computing resources are left
|
||||
unused. A virtual WWW site simple allows more than one WWW site to share a
|
||||
single processor. Instead of having www.domain1.com and www.domain2.com
|
||||
requiring two physical computing devices, www.domain1.com and
|
||||
www.domain2.com can be located on a single computing device and share common
|
||||
resources.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Normally small computing facilities, and small businesses do not have the
|
||||
resources to maintain a dedicated web server and a dedicated Internet
|
||||
connection. These cost can easily start off at $10K for setup, and
|
||||
$500-2500 monthly to maintain. Small computing facilities, and small
|
||||
businesses are now able to "rent" WWW space from a Virtual WWW providers.
|
||||
The customer can then maintain the WWW "pages" using a local telnet and/or
|
||||
FTP connection.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
WWW providers such as InfoCom Networks http://www.infocom.net/
|
||||
provide WWW space as low as $75 per month. A few Virtual Sites
|
||||
might clear up the mystery. So the cost of setting up a WWW site is
|
||||
significantly lower than that of setting up a dedicated server and
|
||||
connection. The Virtual Site has a major advantage over other WWW
|
||||
addressing schemes such as "www.yourprovider.com/~businessname". The
|
||||
Virtual WWW server inherently contains the ability to move to a new location
|
||||
or setup a dedicated WWW server without changing addresses. Changing WWW
|
||||
URL's can result in a major loss of traffic to your site, and lots of
|
||||
business literature updates.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
With most web sites, www.domain1.com and www.domain2.com both resolve to
|
||||
separate IP's. In order to accept multiple request from a single host, the
|
||||
virtual host must be able to answer request for both sites. The method used
|
||||
to solve this problem is called IP aliasing. IP aliasing allows a single
|
||||
host to accept request for multiple IP's. The virtual Web server must have
|
||||
the ability to alias IP's
|
||||
</para>
|
||||
|
||||
<para>
|
||||
IP aliasing is just one part of the virtual solution. The Domain Name System
|
||||
(DNS) also must be configured to resolve both www.domain1.com and
|
||||
www.domain2.com. If domain1.com and domain2.com are new domains, then both
|
||||
must be registered with Internic. Currently, Internic is charging $50 a year
|
||||
to maintain your domain.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Most virtual WWW sites should also provide virtual mail, or the ability to
|
||||
forward all mail to the virtual domain to another user or users.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Virtual FTP or the ability to FTP using the standard host name
|
||||
"ftp.domain1.com" should also be configured by the WWW provider.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="patches">
|
||||
<title>What Software and Software Patches Do I Need?</title>
|
||||
|
||||
<sect2 id="kernel">
|
||||
<title>Linux Kernel</title>
|
||||
|
||||
<para>
|
||||
Linux versions 1.2.X requires the IPalias patch alias-patch-1.2.1-v1
|
||||
and alias-net-tools.tar. I'm not sure if 1.3.X supports this patch yet.
|
||||
For more information on the IPalias patch see
|
||||
ftp://ftp.mindspring.com/users/rsanders/ipalias/
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Using multiple dummy interfaces has been suggested in place of
|
||||
the IPalias solution. While the dummy solution may work,
|
||||
it does not appear to be as clean as the IPalias solution.
|
||||
For more information on using Apache and the dummy solution
|
||||
see Aram Mirzadeh's virtual hosting information at
|
||||
http://www.qosina.com/apache/virtual.html
|
||||
</para>
|
||||
|
||||
<para>
|
||||
All that is required to add a new alias using the IPalias method is:
|
||||
> /sbin/ifconfig eth0 alias www.domainX.com
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Also, the IPalias solution is supported on several other platforms.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="http-patches">
|
||||
<title>HTTP Servers</title>
|
||||
|
||||
<para>
|
||||
NCSA 1.5, Apache, and Spinner support Virtual hosting.
|
||||
http://hoohoo.ncsa.uiuc.edu/docs/Overview.html
|
||||
http://www.apache.org/
|
||||
http://spinner.infovav.se/
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="setup">
|
||||
<title>How Do I set it up?</title>
|
||||
|
||||
<sect2 id="new-account">
|
||||
<title>Create the New Account</title>
|
||||
|
||||
<para>
|
||||
Create a regular Linux account for the virtual customer with home
|
||||
directory and mail.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="http-setup">
|
||||
<title>NCSA 1.5 or Apache Config Files</title>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
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
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>SubDocumentRoot www.domain1.com /usr/local/etc/httpd/docs/domain1
|
||||
SubDocumentRoot www.domain2.com /usr/local/etc/httpd/docs/domain2</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
NCSA and Apache support the following httpd.conf syntax:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<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</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="interface">
|
||||
<title>Configuring the interface</title>
|
||||
|
||||
<para>
|
||||
Once the IPalias patches have been installed add the
|
||||
following to your /etc/rc.d/rc.local on your local web server.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>/sbin/ifconfig eth0 alias www.domain1.com
|
||||
/sbin/ifconfig eth0 alias www.domain2.com
|
||||
/sbin/ifconfig eth0 alias www.domainN.com</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="internic">
|
||||
<title>Registering with Internic</title>
|
||||
|
||||
<para>
|
||||
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
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="named">
|
||||
<title>Configuring Named</title>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
<sect3 id="named-ex-1">
|
||||
<title>Example /etc/named.boot</title>
|
||||
|
||||
<para>
|
||||
<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</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<note>
|
||||
<para>Replace x with your IP.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="named-ex-2">
|
||||
<title>Example /etc/named.data/db.domain1.com</title>
|
||||
|
||||
<para>
|
||||
<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.</programlisting>
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="named-ex-3">
|
||||
<title>Example /etc/named.data/db.xxx.xxx.xxx</title>
|
||||
|
||||
<para>
|
||||
You should already have a db.xxx.xxx.xxx for your current site
|
||||
update it to contain the new virtual domains for reverse lookups
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>xx IN PTR www.domain1.com.
|
||||
xx IN PTR www.domain2.com.</programlisting>
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="named-restart">
|
||||
<title>Restart named</title>
|
||||
|
||||
<para>
|
||||
Once you've finished editing config files, you will need to
|
||||
restart the named daemon.
|
||||
</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="mail">
|
||||
<title>Virtual Mail</title>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
<sect3 id="sendmail">
|
||||
<title>Sendmail Configuration</title>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Retrieve the current version of sendmail that contains makemap btree support.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Create a file called /etc/domainalias with the following mappings:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<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</programlisting>
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Create the maped DB file
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<screen>makemap btree /etc/domainalias.db < /etc/domainalias</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
/etc/sendmail.cf changes:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Add a Cw record for each new virtual host
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>Cwdomain1.com
|
||||
Cwdomain2.com</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Add the domainalias mapping only once.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>Kdomainalias btree /etc/domainalias.db</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Add/Change Ruleset 98
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>###################################################################
|
||||
### Ruleset 98 -- local part of ruleset zero (can be null) ###
|
||||
###################################################################
|
||||
|
||||
S98
|
||||
|
||||
R$+ < $+ . > $1 < $2 > remove trailing dots
|
||||
R$+ < $+ > $: < > $(domainalias $1$2 $) match user@address
|
||||
R< > $+ @ $* $: < $1 > $(domainalias * @ $2 $) match *@address
|
||||
R< $+ > * $* $: < > $1 $2 replace * with userid
|
||||
R < $+ > $+ $: < > $2 bugfix
|
||||
R< > $* $: $>3 $1 and rewrite using S3</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Sendmail Testing
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Test the sendmail configuration to verify the new sendmail.cf changes
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<programlisting>sendmail -v -bv info@domain1.com</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The final destination should be displayed.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="ftp">
|
||||
<title>Virtual FTP</title>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If anyone would like to contribute a solution, I would be more
|
||||
than happy to add it here.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Arnt Gulbrandsen has rewritten ftpd and has included support for
|
||||
independent FTP services The Troll Tech FTP Daemon
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="links">
|
||||
<title>Links to More Virtual Web Information</title>
|
||||
|
||||
<para><ulink url="http://hoohoo.ncsa.uiuc.edu/docs/Overview.html"><citetitle>http://hoohoo.ncsa.uiuc.edu/docs/Overview.html</citetitle></ulink></para>
|
||||
<para><ulink url="http://www.apache.org/"><citetitle>http://www.apache.org/</citetitle></ulink></para>
|
||||
<para><ulink url="http://www.qosina.com/apache/virtual.html"><citetitle>http://www.qosina.com/apache/virtual.html</citetitle></ulink></para>
|
||||
<para><ulink url="http://spinner.infovav.se/"><citetitle>http://spinner.infovav.se/</citetitle></ulink></para>
|
||||
<para><ulink url="ftp://ftp.mindspring.com/users/rsanders/ipalias/"><citetitle>ftp://ftp.mindspring.com/users/rsanders/ipalias/</citetitle></ulink></para>
|
||||
<para><ulink url="http://www.thesphere.com/~dlp/TwoServers/"><citetitle>http://www.thesphere.com/~dlp/TwoServers/</citetitle></ulink></para>
|
||||
<para><ulink url="http://hoohoo.ncsa.uiuc.edu/docs/setup/httpd/VirtualHost.html"><citetitle>http://hoohoo.ncsa.uiuc.edu/docs/setup/httpd/VirtualHost.html</citetitle></ulink></para>
|
||||
<para><ulink url="ftp://ftp.dhp.com:/pub/linux/virtual-hosting"><citetitle>ftp://ftp.dhp.com:/pub/linux/virtual-hosting</citetitle></ulink></para>
|
||||
</sect1>
|
||||
|
||||
</article>
|
Loading…
Reference in New Issue