old-www/LDP/LG/issue34/tag/apache.html

231 lines
9.2 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head>
<META NAME="generator" CONTENT="lgazmail v1.1D.l">
<TITLE>The Answer Guy 34:
Executing "Normal HTML" Files with Apache
</TITLE>
<!-- ORIGINAL SUBJECT:
apache server
JTD SUBTITLE:
-->
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H1 align="center"><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
<a href="../index.html">The Answer Guy</a>
<img src="../../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
</A></H1>
<BR>
<H4 align="center">By James T. Dennis,
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a>
<BR>Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H4>
<p><hr><p>
<!--endcut ========================================================= -->
<H3><img src="../../gx/dennis/qbub.gif" alt="(?)"
width="50" height="28" align="left" border="0"
>Executing "Normal HTML" Files with Apache</H3>
<p><strong>From ajrlly on 26 Sep 1998 </strong></p>
<!-- begin body -->
<p><strong>is there a way to configure apache so that when someone requests a
particular page (ie http://www.whatever.com/~user/index.html) that a cgi
script is automatically invoked, transparent to the requestor. The goal
is to have a diff page served depending on the ip address.
</strong></p>
<p><strong>thnx
</strong></p>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)" height="28" width="50" align="bottom">I think you could use the "x-bit hack" feature ---
mark the index.html page as a Unix/Linux "executable"
and use SSI (server-side include) directives to
accomplish this.
</blockquote>
<blockquote>There are also various modules for Apache to support
XSSI (extended server-side includes) ePerl and EmbPerl
(embedded perl interpreters which execute code your
documents), and other forms of dynamic output.
</blockquote>
<blockquote>For real details you should probably read the FAQ
--- try <A HREF="http://www.apache.org">http://www.apache.org</A> for access to that.
</blockquote>
<blockquote>In addition that FAQ recommends the
comp.infosystems.www.servers.unix newsgroup for general
support. There are also a couple of companies that offer
commercial support for the system.
</blockquote>
<blockquote>You can read about new developments in Apache by regularly
visiting the Apache Week web site (<A HREF="http://www.apacheweek.com">http://www.apacheweek.com</A>)
Which should probably be right next to "Linux Weekly News"
<A HREF="http://www.lwn.net">http://www.lwn.net</A>, on your lists of weekly sites to visit.
</blockquote>
<blockquote>Unfortunately they don't seem to have an "answer guy" over
at Apache Week --- so we can't forward your question off to
him.
</blockquote>
<blockquote>Personally I don't like the idea of publishing different
"apparently static" web pages based on the IP address of the
requestor. First it seems deceitful. Also IP addresses and
DNS domains (reverse or otherwise) are very poor ways of
identifying users or readership. In addition these sorts
of "dynamic" pages put extra load on the server and
add additional latency to the request. This is a
particularly bad idea for index.html pages --- which are
the most often accessed.
</blockquote>
<blockquote>I think it is best to identify what you really want
the world to see (a process of <em>writing</em>, <em>composition</em>
and <em>publication</em>) and put that into your main static
web pages. If you need timely or periodic updates
(web counters, whatever) use a cron job to periodically
re "make" to static pages from their "sources" (templates)
using the text processing tool of your choice (m4 and
the C preprocessor, cpp seem to be particularly popular
for this, although many specialized tools exist for the
task).
</blockquote>
<blockquote>Part of this also depends on what you really trying to
do. For example if you want "internal" users to see
one set of pages and "external" users to see another
--- you best bet is to configure your server with
two interfaces (or at least IP aliases) and use the
Apache "Bind" directive to bind one copy of the Apache
server to one IP address/interface and a different one
(with different configuration, document root, etc) on
the other).
</blockquote>
<blockquote>Naturally each of your virtual hosts ("soft" using HTTP 1.1
features, or "hard" requiring separate IP addresses) can
have completely different document roots and many other
configuration differences. All of that falls under the
category of "virtual hosting" and is covered pretty
extensively in the Apache documentation (which is all
avialable at the aforementioned web sites).
</blockquote>
<blockquote>If you're trying to provide information in a different
language or format based on the source of the request
you should read about "Content Negotiation" at:
</blockquote>
<dl><dt>Apache Week: 26th July 1996
<dd><A HREF="http://www.apacheweek.com/issues/96-07-26">http://www.apacheweek.com/issues/96-07-26</A>
</dl>
<blockquote>If you're attempting to do this based on "security"
or "cookies" there extensive methods for doing this
supported by Apache -- and most of them are most easily
accomplished by performing "redirection" as the
connection is established.
</blockquote>
<blockquote>For real security --- to provide web pages to your
"extranet" partners (strategic customers, vendors,
etc) and your mobile employees --- I wouldn't
suggest anything less then "client side certificates"
over SSL (secure sockets layer --- a set of encryption
protocols, proposed by Netscape and implemented by many
browsers and in several other packages. The dominant
"free" SSL code base is SSLeay --- by Eric A. Young of
Australia).
</blockquote>
<blockquote>These sorts of certificates are issued to users on
and individual basis (they can be from a recognized
third party CA --- certifying authority --- or you can
create your own "in-house" CA and accept those, exclusively
or otherwise.
</blockquote>
<blockquote>There are a large number of modules available for
Apache, some to things like block access based on the
"Referrer" value (to prevent other web sites from
using your pictures and bandwidth by "reference", for
example), or to fix UpperVSLOWER/CasING/ problems in
the requeste URL's, and a couple of different ones to
perform rewriting of request URL's --- like the
mod_rewrite module which supports full regex re-writes
and some weird conditional and variable assignment features.
</blockquote>
<blockquote>It appears that the "official" place to learn about
Apache modules seems to be the "Module Registry" at
<A STUB="http://www.zyzzyva.com">http://www.zyzzyva.com</A>
</blockquote>
<p><em>[ It moved to
<a href="http://modules.apache.org/">http://modules.apache.org/</a> which is much easier to remember too. Update your bookmarks, everybody <img src="../../gx/dennis/smily.gif" alt=":)" border="0" align="middle">
-- Heather ]</em></p>
<!-- end body -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 1998, James T. Dennis <BR>
Published in <I>Linux Gazette</I> Issue 34 November 1998</H5>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<P align="center">
<table width="98%"><tr valign="center" align="center">
<td rowspan="3"><A HREF="../lg_answer34.html"><IMG
SRC="../../gx/dennis/answernew.gif"
ALT="[ Answer Guy Index ]"></A></td>
<td><A HREF="./apache.html">apache</a>
<td><A HREF="./current.html">current</a>
<td><A HREF="./digi.html">digi</a>
<td><A HREF="./ether.html">ether</a>
<td><A HREF="./goodtimes.html">goodtimes</a>
<td><A HREF="./intlX.html">intlX</a>
<td><A HREF="./largedisk.html">largedisk</a>
</tr><tr valign="center" align="center">
<td><A HREF="./maybe.html">maybe</a>
<td><A HREF="./numlock.html">numlock</a>
<td><A HREF="./quota.html">quota</a>
<td><A HREF="./recovery.html">recovery</a>
<td><A HREF="./script.html">script</a>
<td><A HREF="./serial.html">serial</a>
<td><A HREF="./session.html">session</a>
</tr><tr valign="center" align="center">
<td><A HREF="./sound.html">sound</a>
<td><A HREF="./tape.html">tape</a>
<td><A HREF="./testsuite.html">testsuite</a>
<td><A HREF="./w95ie.html">w95ie</a>
<td><A HREF="./w95ras.html">w95ras</a>
<td><A HREF="./w95virus.html">w95virus</a>
<td><A HREF="./xdm.html">xdm</a>
</tr></table>
</P>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="../index.html"><IMG SRC="../../gx/indexnew.gif"
ALT="[ Table Of Contents ]"></A>
<A HREF="../../index.html"><IMG SRC="../../gx/homenew.gif"
ALT="[ Front Page ]"></A>
<A HREF="../lg_bytes34.html"><IMG SRC="../../gx/back2.gif"
ALT="[ Previous Section ]"></A>
<A HREF="../izquierdo.html"><IMG SRC="../../gx/fwd.gif"
ALT="[ Next Section ]"></A>
</body>
</html>
<!--endcut ========================================================= -->