"Fossies" - the Fresh Open Source Software Archive

Member "Apache-Compile-HOWTO/apache.html" (9 Feb 2003, 12373 Bytes) of archive /linux/www/old/Apache-Compile-HOWTO.html.tar.gz:


<HTML
><HEAD
><TITLE
>Getting, build and install Apache with its basic modules</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="Apache Compile HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Prerequisites"
HREF="prereqs.html"><LINK
REL="NEXT"
TITLE="Additional modules"
HREF="modules.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Apache Compile HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="prereqs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="modules.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="APACHE">3. Getting, build and install Apache with its basic modules</H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN357">3.1. Get and untar the Apache Source</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN359">3.1.1. What is <SPAN
CLASS="APPLICATION"
>Apache</SPAN
></H3
><A
NAME="AEN362"><TABLE
BORDER="0"
WIDTH="100%"
CELLSPACING="0"
CELLPADDING="0"
CLASS="BLOCKQUOTE"
><TR
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
><TD
WIDTH="80%"
VALIGN="TOP"
><P
>The Apache Project is a collaborative software development effort aimed at creating a robust, commercial-grade, 
featureful, and freely-available source code implementation of an HTTP (Web) server. The project is jointly managed 
by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop 
the server and its related documentation. These volunteers are known as the Apache Group. In addition, hundreds 
of users have contributed ideas, code, and documentation to the project. This file is intended to briefly describe 
the history of the Apache Group and recognize the many contributors.</P
></TD
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="RIGHT"
VALIGN="TOP"
>--<SPAN
CLASS="ATTRIBUTION"
>www.apache.org</SPAN
></TD
><TD
WIDTH="10%"
>&nbsp;</TD
></TR
></TABLE
><P
>It is simply the best Webserver-Software, it is very flexible to configure to match your needs, 
and it is E-X-T-R-E-M-E stable. I personally never experienced a crash in a productive (=non-experimental stuff) environment</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN366">3.1.2. Download the source</H3
><P
>Origin-Site
<A
HREF="http://www.apache.org/dist/httpd/"
TARGET="_top"
>http://www.apache.org/dist/httpd/</A
>

<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local/

tar -xvzf apache_1.3.27.tar.gz</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN371">3.1.3. Patch for large-scale sites</H3
><P
>	If your webserver should answer very much requests at the same time, and your machine is strong enough to serve 
	such an amount of requests, you can change the limit of maximum running processes</P
><P
>	Download the patch from: <A
HREF="http://www.delouw.ch/linux/apache-patch_HARD_SERVER_LIMIT.txt"
TARGET="_top"
>	http://www.delouw.ch/linux/apache-patch_HARD_SERVER_LIMIT.txt</A
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>--- httpd.h     Thu Mar 21 18:07:34 2002
+++ httpd.h-new Sun Apr  7 13:34:11 2002
@@ -320,7 +320,7 @@
 #elif defined(NETWARE)
 #define HARD_SERVER_LIMIT 2048
 #else
-#define HARD_SERVER_LIMIT 256
+#define HARD_SERVER_LIMIT 512
 #endif
 #endif</PRE
></FONT
></TD
></TR
></TABLE
><P
>This patch does increase the maximum concurrent accessing clients to 512. Feel free to increase it further, 
if you hacked your kernel and edited your <TT
CLASS="FILENAME"
>/etc/security/limits.conf</TT
> </P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Avoid running out of tasks</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>With wrong settings this could end as a »self-denial-of-service-attack«
Be sure you have enough processes left for root)</P
></TD
></TR
></TABLE
></DIV
><P
>Apply the patch using:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local/apache_1.3.27/src/include

patch -p0 &#60; apache-patch_HARD_SERVER_LIMIT.txt</PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN384">3.2. mod_ssl</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN386">3.2.1. What is mod_ssl</H3
><A
NAME="AEN388"><TABLE
BORDER="0"
WIDTH="100%"
CELLSPACING="0"
CELLPADDING="0"
CLASS="BLOCKQUOTE"
><TR
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
><TD
WIDTH="80%"
VALIGN="TOP"
><P
>This module provides strong cryptography for the Apache 1.3 webserver via the Secure Sockets Layer (SSL v2/v3) and 
Transport Layer Security (TLS v1) protocols by the help of the Open Source SSL/TLS toolkit OpenSSL, which is 
based on SSLeay from Eric A. Young and Tim J. Hudson.</P
></TD
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="RIGHT"
VALIGN="TOP"
>--<SPAN
CLASS="ATTRIBUTION"
>www.modssl.org</SPAN
></TD
><TD
WIDTH="10%"
>&nbsp;</TD
></TR
></TABLE
><P
>	This module is needed to enable Apache for SSL-Requests (https). It applies a patch to the Apache 
	source-code and extends its <SPAN
CLASS="ABBREV"
>API</SPAN
> (Application Programming Interface). The result is
	called  <SPAN
CLASS="ABBREV"
>EAPI</SPAN
> (Extended Application Programming Interface).</P
><P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Use of compilerflags while compiling modules</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Make sure any module for your Apache server is compiled with the compiler-flag <TT
CLASS="OPTION"
>-DEAPI</TT
>, or your 
Webserver might crash or can not be started.</P
></TD
></TR
></TABLE
></DIV
>&#13;</P
><P
>Almost all modules I know adds the <TT
CLASS="OPTION"
>-DEAPI</TT
> flag by themself except <SPAN
CLASS="APPLICATION"
>mod_jserv</SPAN
>
 and <SPAN
CLASS="APPLICATION"
>mod_jk</SPAN
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN403">3.2.2. Download the source</H3
><P
>Origin-Site:<A
HREF="http://www.modssl.org"
TARGET="_top"
>http://www.modssl.org</A
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN407">3.2.3. Applying the patch to the Apache source</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local/

tar -xvzf mod_ssl-2.8.12-1.3.27.tar.gz
cd mod_ssl-2.8.12-1.3.27/

./configure --with-apache=../apache_1.3.27 </PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN410">3.3. mod_perl</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN412">3.3.1. What is mod_perl</H3
><A
NAME="AEN414"><TABLE
BORDER="0"
WIDTH="100%"
CELLSPACING="0"
CELLPADDING="0"
CLASS="BLOCKQUOTE"
><TR
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
><TD
WIDTH="80%"
VALIGN="TOP"
><P
>With mod_perl it is possible to write Apache modules entirely in Perl. In addition, the persistent 
interpreter embedded in the server avoids the overhead of starting an external interpreter and the 
penalty of Perl start-up time. </P
></TD
><TD
WIDTH="10%"
VALIGN="TOP"
>&nbsp;</TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="RIGHT"
VALIGN="TOP"
>--<SPAN
CLASS="ATTRIBUTION"
>perl.apache.org</SPAN
></TD
><TD
WIDTH="10%"
>&nbsp;</TD
></TR
></TABLE
><P
><SPAN
CLASS="APPLICATION"
>mod_perl</SPAN
> is a kind of substitute for cgi-bin's. cgi's typically forks a new process for each request, 
and produces overhead. With mod_perl the perl-interpreter is loaded persistent in 
the Apache server and does not need to fork processes for each request.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN419">3.3.2. Download the source</H3
><P
>Origin-Site: <A
HREF="http://www.apache.org/dist/perl"
TARGET="_top"
>http://www.apache.org/dist/perl</A
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN423">3.3.3. Building and installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local

tar -xvzf mod_perl-1.27.tar.gz

cd mod_perl-1.27

perl Makefile.PL \
EVERYTHING=1 \
APACHE_SRC=../apache_1.3.27/src \
USE_APACI=1 \
PREP_HTTPD=1 \
DO_HTTPD=1

make
make install</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Mod_perl can not be compiled as DSO</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Do not compile mod_perl as <SPAN
CLASS="ABBREV"
>DSO</SPAN
> (Dynamic Shared Object)! According 
to various sources, Apache will crash (I never tried).</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN430">3.4. Configure and build Apache</H2
><P
>Now the two static modules <SPAN
CLASS="APPLICATION"
>mod_ssl</SPAN
> and <SPAN
CLASS="APPLICATION"
>mod_perl</SPAN
>
 are configured and the Apache Source has been patched, and we can proceed with building Apache.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN435">3.4.1. Building and installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>EAPI_MM="/usr/local/mm-1.2.2" SSL_BASE="/usr/local/ssl" \
./configure \
--enable-module=unique_id \
--enable-module=rewrite \
--enable-module=speling \
--enable-module=expires \
--enable-module=info \
--enable-module=log_agent \
--enable-module=log_referer \
--enable-module=usertrack \
--enable-module=proxy \
--enable-module=userdir \
--enable-module=so \
--enable-shared=ssl \
--enable-module=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=perl

make
make install</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN438">3.4.2. Create self-signed SSL-certificate</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local/ssl/bin

./openssl req -new &#62; new.cert.csr
./openssl rsa -in privkey.pem -out new.cert.key
./openssl x509 -in new.cert.csr -out new.cert.cert \
-req -signkey new.cert.key -days 999

cp new.cert.key /usr/local/apache/conf/ssl.key/server.key
cp new.cert.cert /usr/local/apache/conf/ssl.crt/server.crt&#13;</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Common name</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>OpenSSL asks for different things. A common error is to enter a wrong "common name". 
This should be the FQHN (Fully Qualified HostName) of your Server, i.e www.foo.org</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="prereqs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="modules.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Prerequisites</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Additional modules</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>