Caauwe Family Website Family Connection
Website Setup, Web Server...
Follow the instructions below to install the Web Server components.  The Web Server components that will be installed are Apache2, PHP5, additional PHP components Tomcat V5.5, Mod-JK and SSL certificate software.  If one or more of the components are not needed, feel free to skip the steps that install the component.
  1. Login the server as root.
  2. Type: apt-get install apache2
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
  3. Type: apt-get install php5
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
  4. The following will support sending email from PHP:
    Type: apt-get install php-pear
    Type: apt-get install php-mail
    Type: apt-get install php-net-smtp
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
  5. Type: apt-get install ssl-cert
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
  6. Type: apt-get install tomcat5.5
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
    NOTE: There will be an error when Tomcat is installed.
  7. Modify /etc/default/tomcat5.5 (See the example below)
    set TOMCAT5_SECURITY=NO (to fix the error)
    set JAVA_HOME=/usr/lib/jvm/jre1.6.0_03 (to point to the Java Runtime)
  8. Type: cp /usr/local/mysql-connector-java-5.1.5/mysql-connector-java-5.1.5-bin.jar /usr/share/tomcat5.5/common/lib
  9. Modify /var/lib/tomcat5.5/conf/context.xml to add the MySQL connection pool.
  10. Although it may not be necessary, I'd recommend restarting the server.
  11. When the reboot completes, login the server as root.
  12. Type: apt-get install libapache2-mod-jk
    (This will install the interface between Apache and Tomcat)
    When requested, enter 'y' to continue the installation.
    If needed, install the requested Debian CD and press enter.
  13. Type: cd /etc/apache2/mods-enabled
  14. Type: ln -s /etc/apache2/mods-available/include.load ./include.load
  15. Modify /etc/apache2/ports.conf
  16. Modify /etc/apache2/sites-available/default
  17. Modify /etc/apache2/httpd.conf
  18. Modify /etc/libapache2-mod-jk/workers/properties
  19. Type: mkdir /etc/apache2/ssl
  20. Type: /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
    This program will request information to be placed in the certificate.
  21. Type: a2enmod ssl
  22. Type: mkdir /var/www/caauwe.com
    Change the 'caauwe.com' to the domain name of your choice.
    The domain name is used in: /etc/apache2/sites-available/default
  23. Deploy the domain root application to /var/www/caauwe.com
  24. Deploy the Java web applications to /var/lib/tomcat5.5/webapp
Filename: /etc/default/tomcat5.5
This is the primary configuration file for Tomcat.
# Run Tomcat as this user ID (default: tomcat55). Set this to an empty string
# to prevent Tomcat from starting.
#TOMCAT5_USER=tomcat55

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
JAVA_HOME=/usr/lib/jvm/jre1.6.0_03

# Directory for per-instance configuration files and webapps. It contain the
# directories conf, logs, webapps, work and temp. See RUNNING.txt for details.
# Default: /var/lib/tomcat5.5
#CATALINA_BASE=/var/lib/tomcat5.5

# Arguments to pass to the Java virtual machine (JVM)
# "-Djava.awt.headless=true -Xmx128M" is automatically set if CATALINA_OPTS
# is left empty here
#CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server"

# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=jikes

# Use the Java security manager? (yes/no, default: yes)
# WARNING: Do not disable the security manager unless you understand
# the consequences!
# NOTE: java-gcj-compat-dev currently doesn't support a security
# manager.
TOMCAT5_SECURITY=no

# Timeout in seconds for the shutdown procedure (default: 30). The Java
# processes will be killed if tomcat5.5 has not stopped until then.
#TOMCAT5_SHUTDOWN=30
Filename: /var/lib/tomcat5.5/conf/context.xml
This file provides the information for Tomcat to connect to the MySQL database.  If there are no Java web applications that use a connection pool, no modifications are needed.  Replace [username] and [password] with the corresponding values setup in MySQL.  Please note that 'root' should not be used.
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <Resource name="jdbc/fcWebApp"
    auth="Container"
    type="javax.sql.DataSource"
    username="[username]"
    password="[password]"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://fc5:3306/"
    maxActive="10"
    maxIdle="4"
    maxWait="1000" />

</Context>
Filename: /etc/apache2/ports.conf
This file contains the IP port numbers that Apache will use to communicate with the client browser.
Listen 80
Listen 443
Filename: /etc/apache2/sites-available/default
This file defines the location of the web site.  Make sure to replace [email-address] with your email address, and replace the '/var/www/caauwe.com' folder with the name setup in the instructions above.
NameVirtualHost *:443
NameVirtualHost *:80

<VirtualHost *:80>
    ServerName fc1.caauwe.com
    ServerAdmin [email-address]

    DocumentRoot /var/www/caauwe.com/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/caauwe.com>
        AddType text/html .htm
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
        AddOutputFilter INCLUDES .htm
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

</VirtualHost>

<VirtualHost *:443>
    ServerName fc1.caauwe.com
    ServerAdmin [email-address]

    DocumentRoot /var/www/caauwe.com/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/caauwe.com>
        AddType text/html .htm
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
        AddOutputFilter INCLUDES .htm
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>
Filename: /etc/apache2/httpd.conf
This file contains the default page to display followed by Mod-JK definitions.  Make sure to change [java-appl-#] with the name of the Java web application.
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

# for all commands/options available see the manual
# provided in libapache-mod-jk-doc package.

# The location where mod_jk will find the workers definitions
JkWorkersFile /etc/libapache2-mod-jk/workers.properties

# The location where mod_jk is going to place its log file
JkLogFile /var/log/apache2/mod_jk.log

# The log level:
# - info log will contain standard mod_jk activity (default).
# - warn log will contain non fatal error reports.
# - error log will contain also error reports.
# - debug log will contain all information on mod_jk activity
# - trace log will contain all tracing information on mod_jk activity
JkLogLevel info


# This was from the FC2 configuration:
#LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

# Select the log format
#JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE,
#JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
#JkRequestLogFormat "%w %V %T"


# Assign specific URLs to Tomcat. In general the structure of a
# JkMount directive is: JkMount [URL prefix] [Worker name]

# send all requests ending in .jsp to ajp13_worker
#JkMount /*.jsp ajp13_worker
# send all requests ending /servlet to ajp13_worker
#JkMount /*/servlet/ ajp13_worker

# Send servlet for below context to worker named worker1
JkMount /[java-appl-1] ajp13_worker
JkMount /[java-appl-2] ajp13_worker
JkMount /[java-appl-3] ajp13_worker

#Send JSPs for below context to worker named worker1
JkMount /[java-appl-1]/* ajp13_worker
JkMount /[java-appl-2]/* ajp13_worker
JkMount /[java-appl-3]/* ajp13_worker

# JkUnmount directive acts as an opposite to JkMount and blocks access
# to a particular URL. The purpose is to be able to filter out the
# particular content types from mounted context.

# do not send requests ending with .gif to ajp13_worker
#JkUnMount /servlet/*.gif ajp13_worker


# JkMount / JkUnMount directives can also be used inside <VirtualHost>
# sections of your httpd.conf file.
Filename: /etc/libapache2-mod-jk/workers.properties
This file defines the properties to run the Mod-JK interface.  Note the 'workers.java_home=/usr/lib/jvm/jre1.6.0_03' parameter.
# workers.properties -
#
# This file is a simplified version of the workers.properties supplied
# with the upstream sources. The jni inprocess worker (not build in the
# debian package) section and the ajp12 (deprecated) section are removed.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to do is un-comment and modify the first three
# properties, i.e. workers.tomcat_home, workers.java_home and ps.
# Most of the configuration is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 3 workers configured:
#
# - An ajp13 worker that connects to localhost:8009
# - A load balancer worker
#
#

# OPTIONS ( very important for jni mode )

#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/usr/share/tomcat5.5

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/jre1.6.0_03

#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/

#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#

#
#------ worker list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
worker.list=ajp13_worker

#
#------ ajp13_worker WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named ajp13_worker and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13_worker.lbfactor=1

#
# Specify the size of the open connection cache.
#worker.ajp13_worker.cachesize

#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#

#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13_worker