Whole document tree
    

Whole document tree

Getting, build and install Apache with its basic modules

3. Getting, build and install Apache with its basic modules

3.1. Get and untar the Apache Source

3.1.3. Patch for largescale sites

If your webserver should answer very much requests at the same time, and your machine is strong enought to serv such an amount of requests, you can change the limit of maximum running processes

Download the patch from: http://www.delouw.ch/linux/apache-patch_HARD_SERVER_LIMIT.txt


--- httpd.h-old Wed Jan 31 00:58:19 2001 
+++ httpd.h Wed Jan 31 01:09:25 2001 
@@ -314,7 +314,7 @@ 
#ifdef WIN32 
#define HARD_SERVER_LIMIT 1024 
#else 
-#define HARD_SERVER_LIMIT 256 
+#define HARD_SERVER_LIMIT 512 
#endif 
#endif

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 /etc/security/limits.conf (this is ONLY for experienced users! With wrong settings this could end as a “self-denial-of-service-attack”!! Be sure you have enought processes left for root)

Apply the patch using:

cd /usr/local/apache_1.3.23/src/include

patch -p0 < apache-patch_HARD_SERVER_LIMIT.txt

3.4. Configure and build Apache

Now the two static modules mod_ssl and mod_perl are configured and the Apache Source has been patched, and we can proceed with building Apache.

3.4.1. Building and installing


EAPI_MM="/usr/local/mm-1.1.3" 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

3.4.2. Create self-signed SSL-certificate


cd /usr/local/ssl/bin

./openssl req -new > 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

Notice: 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

3.7. mod_auth_mysql

3.7.3. Building and installing


gunzip mod_auth_mysql.c.gz

/usr/local/apache/bin/apxs \
-c -I/usr/local/mysql/include \
-L/usr/local/mysql/lib/mysql \
-lmysqlclient -lm mod_auth_mysql.c

cp mod_auth_mysql.so /usr/local/apache/libexec/

Add this line in your httpd.conf:

LoadModule mysql_auth_module libexec/mod_auth_mysql.so

And where the other modules are added:

AddModule mod_auth_mysql.c

Take care that the path of Mysql libs and includes are correct!

Notice: Be sure that /usr/local/mysql/lib/mysql is in /etc/ld.so.conf befor compiling

Use AuthMySQLCryptedPasswords Off or it does not work! (under investigation why not)

3.7.4. Sample configuration

3.7.4.1. /usr/local/apache/conf/httpd.conf


<location /manual/>
  AuthType Basic
  AuthUserfile /dev/null
  AuthName Testing
  AuthGroupFile /dev/null
  AuthMySQLHost localhost
  AuthMySQLCryptedPasswords Off
  AuthMySQLUser root
  AuthMySQLDB users
  AuthMySQLUserTable user_info
  <Limit GET POST>
    require valid-user
  </limit>
</location>

3.7.4.2. Script for creating the MySQL-Database

just type:


mysql < authmysql.sql

The File authmysql.sql contents:


  create database http_users;
  connect http_users;

  CREATE TABLE user_info (
  user_name CHAR(30) NOT NULL,
  user_passwd CHAR(20) NOT NULL,
  user_group CHAR(10),
  PRIMARY KEY (user_name);