Using BlackBoard with Apache 2.2.x

At BbWorld/DevCon 2011 this year I attended a fantastic talk from José Manuel López Luján and Juan Francisco García García, both out of Tec de Monterrey in Mexico. The topic was Tuning BlackBoard 9 for high-demand environments, you can get their slides here. They had a lot of very interesting material in it, but one of the more fascinating things was that they’d literally pulled out Apache 1.3.x, which is bundled with BlackBoard, and inserted Apache 2.2.x in its place. Needless to say, I was very interested to see how they did it and try and replicate it in my environment.

Seeing as they’re using Solaris and I’m using Linux, I thought I’d give it a try based heavily on their notes (the beginning of which are here).

I’m copying and pasting these notes from my own Wiki, so the formatting might not be great. So, if you want a more complete version or have any questions, please let me know! You can find me on Twitter here; Jose is @jmanuel_ll and Juan is @jfgarcia11.

Again, thanks to them for their great idea and their documentation and support in getting this going on Linux. Rumor on the street is that Bb are pursuing modularization of the web server functionality on their own and we might see something like this in production some time soon!

These notes are all for RHEL5 64-bit Linux & BlackBoard 9.1.

Pre-requisites

yum -y install autoconf gcc make openssl-devel

# note we’re using an RPM of OpenSSL

Apache

Compiling options

Configuring httpd:

./configure --prefix=/usr/local/blackboard/apps/httpd \
--enable-ssl \
--enable-status \
--enable-autoindex \
--enable-setenvif \
--enable-alias \
--enable-so \
--enable-cache \
--enable-rewrite \
--enable-proxy \
--enable-proxy-http \
--enable-mem-cache \
--enable-file-cache \
--enable-headers \
--enable-usertrack \
--enable-expires \
--enable-deflate \
--enable-proxy-ajp \
--with-mpm=prefork \
--with-ssl=/usr \
--with-included-apr \
--with-mod_jk \
--disable-charset-lite

Optional configure flags

--enable-disk-cache --enable-mem-cache --enable-deflate

Compiling & installing

make && make install

BlackBoard

Startup scripts

ServiceController.sh

cp /usr/local/blackboard/apps/httpd/bin/apachectl /usr/local/blackboard/apps/httpd/
cp /usr/local/blackboard/apps/httpd/bin/apachectl /usr/local/blackboard/apps/httpd/apachectl.bb

apachectl.bb

Edit the file to reflect the following changes:

PIDFILE=@@bbconfig.basedir@@/apps/httpd/logs/httpd.pid
#
# the path to your httpd binary, including options if necessary
HTTPD='@@bbconfig.basedir@@/apps/httpd/bin/httpd'
#
# pick up any necessary environment variables
if test -f @@bbconfig.basedir@@/apps/httpd/bin/envvars; then
  . @@bbconfig.basedir@@/apps/httpd/bin/envvars
fi

httpd.conf.bb

First:

cp /usr/local/blackboard/apps/httpd/conf/httpd.conf /usr/local/blackboard/apps/httpd/conf/httpd.conf.bb

Second, change all instances of /usr/local/blackboard to @@bbconfig.basedir@@

Now, have the file reflect the following:

ServerRoot "@@bbconfig.basedir@@/apps/httpd"
Listen @@bbconfig.unix.httpd.portnumber@@

Now, add the following:

LockFile @@bbconfig.basedir@@/logs/httpd/httpd.lock
PidFile @@bbconfig.basedir@@/apps/httpd/logs/httpd.pid
Timeout 300

Add the following:

KeepAlive @@bbconfig.unix.httpd.keepalive@@
MaxKeepAliveRequests 100
KeepAliveTimeout @@bbconfig.unix.httpd.keepalivetimeout@@
MinSpareServers @@bbconfig.unix.httpd.minspareservers@@
MaxSpareServers @@bbconfig.unix.httpd.maxspareservers@@
StartServers  @@bbconfig.unix.httpd.startservers@@
MaxClients @@bbconfig.unix.httpd.maxclients@@
MaxRequestsPerChild @@bbconfig.unix.httpd.maxrequestsperchild@@

Add the following:

# Autoindex config

IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
ReadmeName README
HeaderName HEADER
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

Add the following:

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

Add the following:

DirectoryIndex index.html

Add the following:

Include conf/proxy_ajp.conf

(See below for populating proxy_ajp.conf.)

proxy_ajp.conf

        ProxyRequests Off
        # Proxy Exception 
        ProxyPassMatch ^(/img/.*)$ ! 
        ProxyPassMatch ^(/special/.*)$ !
        ProxyPassMatch ^(/server-.*)$ !
        # remove TRACE support
        ReWriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        ReWriteRule .* - [F]



        # always keep the host header
        ProxyPreserveHost On
        LogLevel warn   
        ErrorLog /usr/local/blackboard/logs/httpd/error_ajp_log
        
          Order deny,allow
          Allow from all
        
        ProxyPass / ajp://localhost:8009/               

Note that the ProxyPass parameter specifies port 8009, which is different to port 8007 in the Tec de Monterrey documentation. This is because our bb-config.properties file specifies:

bb-config.properties:bbconfig.appserver.portnumber=8009
bb-config.properties:bbconfig.appserver.shutdown.portnumber=8005
bb-config.properties:bbconfig.collabserver.shutdown.portnumber=8006

ssl.conf

You can find full documentation for the mod_ssl config file here: [http://httpd.apache.org/docs/2.2/mod/mod_ssl.html here]. You’ll need to:

cp /usr/local/blackboard/apps/httpd.working/conf/ssl.conf /usr/local/blackboard/apps/httpd/conf
cp /usr/local/blackboard/apps/httpd.working/conf/ssl.conf.bb /usr/local/blackboard/apps/httpd/conf
mkdir /usr/local/blackboard/apps/httpd/conf/certs
cp /usr/local/blackboard/apps/httpd.working/conf/ssl.crt/server.crt /usr/local/blackboard/apps/httpd/conf/certs
cp /usr/local/blackboard/apps/httpd.working/conf/ssl.crt/server.key /usr/local/blackboard/apps/httpd/conf/certs

Now you’re ready to make the following changes to the .bb file:

ssl.conf.bb

LoadModule ssl_module libexec/libssl.so
SSLCertificateFile @@bbconfig.unix.ssl.certificatefile@@
SSLCertificateKeyFile @@bbconfig.unix.ssl.certificatekeyfile@@
SSLLog @@bbconfig.basedir@@/logs/ssl_engine_log
SSLRandomSeed startup builtin
Listen @@bbconfig.unix.httpd.portnumber@@
Listen @@bbconfig.unix.httpd.ssl.portnumber@@
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLProtocol All
SSLCipherSuite !EXP1024-RC4-SHA:!EXP1024-DES-CBC-SHA:ALL:!ADH:!EXP56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

#This line is needed to make SSL and IE work correctly.
#See: http://httpd.apache.org/docs-2.1/ssl/ssl_faq.html#msie
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

#Inter Process Session Cache
SSLSessionCache dbm:@@bbconfig.basedir@@/logs/httpd/ssl_cache
SSLSessionCacheTimeout 300


SSLEngine On
ProxyRequests Off
RewriteEngine on
RewriteRule ^/$ /index.html
#pass requests for / to /index.html
# We do not support perl servlets anymore
JkMountCopy On

Note that these changes reference the following from bb-config.properties:

bbconfig.unix.httpd.ssl.portnumber=443

bbconfig.unix.ssl.certificatefile=/usr/local/blackboard/apps/httpd/conf/certs/server.crt
bbconfig.unix.ssl.certificatekeyfile=/usr/local/blackboard/apps/httpd/conf/certs/server.key

That’s it for now — I’ve gotten this working in Bb 9.1 SP6 but I haven’t had the time yet to perform any significant benchmarking. More to follow when it comes…

Advertisements

2 thoughts on “Using BlackBoard with Apache 2.2.x

  1. Great work and documentation and encourage you to test mod_pagespeed if you have RHEL 5 with your brand new Apache 2.2.x installation =)

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s