Rev 1293 | Blame | Last modification | View Log | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><TITLE>Apache webserver configuration</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINKREL="HOME"TITLE="The Codestriker Guide"HREF="book1.html"><LINKREL="UP"TITLE="Installation"HREF="c49.html"><LINKREL="PREVIOUS"TITLE="Running install.pl"HREF="x234.html"><LINKREL="NEXT"TITLE="IIS configuration"HREF="x302.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The Codestriker Guide: Version 1.9.3</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x234.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 2. Installation</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x302.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN248">2.4. Apache webserver configuration</A></H1><P> This section deals with deploying Codestriker using Apache, oneither a UN*X machine or Win32.Codestriker can run as an ordinary CGI script, which allows itto run under any CGI-complaint webserver. The followingconfiguration details are specific for the Apache webserver(<AHREF="http://httpd.apache.org"TARGET="_top">http://httpd.apache.org</A>),which is available for download for both UNIX and Windowplatforms. Apache should be already available for most UNIXdistributions. Apache 1.X or 2.X can be used for Win32 systemsdeploying Codestriker as a CGI script. For Win32 mod_perlinstallations, Apache 1.X is recommended.</P><P> <SPANCLASS="emphasis"><ICLASS="EMPHASIS">Note any Codestriker or Apache configuration changesrequire the Apache server to be restarted.</I></SPAN> ForUNIX, a command like the following is required:<PRECLASS="PROGRAMLISTING">/etc/init.d/httpd restart</PRE>or<PRECLASS="PROGRAMLISTING">/etc/init.d/apache restart</PRE></P><P> For Windows, the Apache shell window can be terminated bypressing ^C, and started from the Windows menu. There arealso shortcuts from the menu for editing the Apacheconfiguration file.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN257">2.4.1. CGI Script</A></H2><P> If you installed Codestriker into<TTCLASS="FILENAME">/var/www/codestriker/codestriker-X.Y.Z</TT>,the configuration you need in your<TTCLASS="FILENAME">apache.conf</TT> file (normally located ineither<TTCLASS="FILENAME">/etc/httpd.conf</TT>,<TTCLASS="FILENAME">/etc/apache.conf</TT> or<TTCLASS="FILENAME">/etc/httpd/conf/httpd.conf</TT>) is thefollowing:<PRECLASS="PROGRAMLISTING">ScriptAlias /codestriker/ /var/www/codestriker/codestriker-X.Y.Z/cgi-bin/Alias /codestrikerhtml/ /var/www/codestriker/codestriker-X.Y.Z/html/<Directory "/var/www/codestriker/codestriker-X.Y.Z/cgi-bin/">AllowOverride NoneOptions ExecCGIOrder allow,denyAllow from allSetHandler cgi-script</Directory><Directory "/var/www/codestriker/codestriker-X.Y.Z/html/">AllowOverride NoneAllow from all</Directory></PRE>For Windows, the configuration is the same, but filenamepaths should use '/' rather than '\'. An exampleconfiguration could be the following, if Codestriker wasinstalled in<TTCLASS="FILENAME">c:\codestriker\codestriker-X.Y.Z</TT>.<PRECLASS="PROGRAMLISTING">ScriptAlias /codestriker/ "C:/codestriker/codestriker-X.Y.Z/cgi-bin/"Alias /codestrikerhtml/ "C:/codestriker/codestriker-X.Y.Z/html/"<Directory "C:/codestriker/codestriker-X.Y.Z/cgi-bin/">AllowOverride NoneOptions ExecCGIOrder allow,denyAllow from allSetHandler cgi-script</Directory><Directory "C:/codestriker/codestriker-X.Y.Z/html/">AllowOverride NoneAllow from all</Directory></PRE></P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN268">2.4.2. Apache 1.X mod_perl</A></H2><P> Using <BCLASS="COMMAND">mod_perl</B> provides performancebenefits for Perl-based web applications. For CGIdeployments, as described in the previous section, each HTTPrequest will create a <SPANCLASS="emphasis"><ICLASS="EMPHASIS">new</I></SPAN> Perlinterpreter, which needs to initialise, and then parse theCodestriker source code. This may add significant latencyfor each HTTP request.</P><P> Using <BCLASS="COMMAND">mod_perl</B>, a pool of Perlinterpreters which have already parsed the Codestrikersource code is maintained, so that whenever an HTTP requestis issued, the time spent creating a new Perl interpreterand the parsing of the Codestriker code is removed.</P><P> <BCLASS="COMMAND">Mod_perl</B> is available for download from<AHREF="http://perl.apache.org"TARGET="_top">http://perl.apache.org</A>.For most UNIX distributions, it is available by default withApache. For installing <BCLASS="COMMAND">mod_perl</B> underWindows, <AHREF="http://www.webmatrix.net/log/modperl-win32"TARGET="_top">http://www.webmatrix.net/log/modperl-win32</A>contains installation information. Youshould be able to install it by typing:<PRECLASS="PROGRAMLISTING">C:\> ppmPPM> rep add theory http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58PPM> install mod_perl</PRE>Note mod_perl has known to be a little flaky under Windows.Make sure you get Codestriker working deployed as a CGIscript before trying to use mod_perl.</P><P> The following shows the configuration settings for an Apache1.X server with <BCLASS="COMMAND">mod_perl</B> enabled, for aCodestriker distribution installed in<TTCLASS="FILENAME">/var/www/codestriker/codestriker-X.Y.Z</TT>.<PRECLASS="PROGRAMLISTING">Alias /codestriker/ /var/www/codestriker/codestriker-X.Y.Z/cgi-bin/Alias /codestrikerhtml/ /var/www/codestriker/codestriker-X.Y.Z/html/<Directory "/var/www/codestriker/codestriker-X.Y.Z/cgi-bin/">SetHandler perl-scriptPerlHandler Apache::RegistryOptions +ExecCGI</Directory><Directory "/var/www/codestriker/codestriker-X.Y.Z/html/">AllowOverride NoneAllow from all</Directory></PRE>The settings for Windows are the same, only the pathnameswill be different, as per the CGI configuration in theprevious section.</P><P> For extra security, Codestriker supports Perl taint-mode, soit is advisable to also have the following option in yourApache config:<PRECLASS="PROGRAMLISTING">PerlTaintCheck On</PRE>Note if you are using LXR on the same webserver, this optioncannot be used. You'll also need to remove the<CODECLASS="OPTION">-T</CODE> argument from<TTCLASS="FILENAME">bin/codestriker.pl.base</TT>, and re-run<BCLASS="COMMAND">install.pl</B> again (see <AHREF="x234.html">Section 2.3</A>) if you want to useCodestriker and LXR.</P><P> Also note there is a strange issue with Perl 5.8 on Win32,the open3() call and taint mode. For Win32 users, don't enabletainted mode.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN292">2.4.3. Apache 2.X mod_perl</A></H2><P> For Apache 2.X, make sure the <BCLASS="COMMAND">mod_perl</B>module is loaded when Apache starts. Near the top of theApache config file, you should see commands like thefollowing:<PRECLASS="PROGRAMLISTING">LoadModule perl_module modules/mod_perl.soPerlModule Apache2</PRE>If these commands aren't present, and a Perl startup file isnot being used, make sure these are added in.</P><P> The Codestriker configuration for Apache 2.X is verysimilar, the only change is the name of the PerlHandler.<PRECLASS="PROGRAMLISTING">Alias /codestriker/ /var/www/codestriker/codestriker-X.Y.Z/cgi-bin/Alias /codestrikerhtml/ /var/www/codestriker/codestriker-X.Y.Z/html/<Directory "/var/www/codestriker/codestriker-X.Y.Z/cgi-bin/">SetHandler perl-scriptPerlHandler ModPerl::RegistryOptions +ExecCGI</Directory><Directory "/var/www/codestriker/codestriker-X.Y.Z/html/">AllowOverride NoneAllow from all</Directory></PRE></P><P> To enable Perl taint mode checking, using the followingoption:<PRECLASS="PROGRAMLISTING">PerlSwitches -T</PRE></P><P> As mentioned in the previous section, Win32 users shouldnot enable this mode.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x234.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x302.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Running install.pl</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="c49.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">IIS configuration</TD></TR></TABLE></DIV></BODY></HTML>