Integrate Tomcat, Apache, Subversion, WebSvn, SSL on Windows

# WI
# 31-MAY-2010
#

================================================================================
INSTALL APACHE TOMCAT 6.0.26
================================================================================
1. install jdk-6u17-javafx-1_2_1-windows-i586.exe
    -> C:\Program Files (x86)\Java\jdk1.6.0_17\
2. add environment variables
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_17
JRE_HOME =C:\Program Files (x86)\Java\jre6
2. unzip apache-tomcat-6.0.26-windows-x86.zip
    -> G:\Tomcat\
3. edit G:\tomcat\conf\server.xml
    => <Connector port=”8123″ protocol=”HTTP/1.1″
4. edit G:\tomcat\conf\tomcat-users.xml
    => <role rolename=”manager”/>
           <user username=”wi” password=”wi” roles=”manager”/>
5. run G:\tomcat\bin\startup.bat
6. try on browser
    -> http://localhost:8123
you should see,
    >> Apache Tomcat logo,
           Apache Foundation banner,
           page with showing text :
           “If you’re seeing this page via a web browser, it means you’ve setup Tomcat successfully. Congratulations!
================================================================================

================================================================================
INSTALL APACHE HTTP SERVER 2.2.15
================================================================================
1. install httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi
    -> G:\Apache\
2. input:
    Network Domain = localhost
    Server Name = localhost
    Administrator’s Email Address = williamxhi@yahoo.com
3. try on browser
    -> http://localhost
you should see,
    >> It works!
================================================================================

================================================================================
INSTALL SUBVERSION 1.6.6
================================================================================
1. install Setup-Subversion-1.6.6.msi
    -> G:\Subversion\
2. try on command prompt
    -> set path=%PATH%;G:\Subversion\bin
        svn help

Initialize the repository
————————-
on command prompt
1. G:
2. G:\>mkdir G:\svnrepos
3. G:\>mkdir G:\svnrepos\repo1
4. svnadmin create G:\svnrepos\repo1
================================================================================

================================================================================
INTEGRATE SUBVERSION – APACHE MODULES
================================================================================
1. copy mod_dav_svn.so & mod_authz_svn.so from G:\Subversion\bin to G:\Apache\modules
2. copy libdb44.dll & intl3_svn.dll from G:\Subversion\bin to G:\Apache\bin
2. edit G:\Apache\conf\httpd.conf, add these lines
    -> # All SVN directives
Include conf/extra/httpd-svn.conf
3. create new file G:\Apache\conf\extra\httpd-svn.conf
4. edit G:\Apache\conf\extra\httpd-svn.conf, add these lines
    -> # Load Subversion Apache Modules mod_dav.so, mod_dav_svn.so & mod_authz_svn.so from Subversion-1.6.6
          LoadModule dav_module modules/mod_dav.so
          LoadModule dav_svn_module modules/mod_dav_svn.so
          LoadModule authz_svn_module modules/mod_authz_svn.so

          # Enable Subversion
          DAV svn
          # Directory containing all repository for this path
          SVNParentPath G:/svnrepos

5. try on browser
    -> http://localhost/svn/repo1/
you should see,
    >> repo1 – Revision 0: /
================================================================================

================================================================================
INSTALL PHP 5.3.2
================================================================================
1. unzip php-5.3.2-Win32-VC9-x86.zip
    -> G:\PHP\
2. on command prompt
G:\PHP>copy G:\PHP\php.ini-development G:\PHP\php.ini /v
3. edit G:\Apache\conf\httpd.conf, add these lines
    -> # For PHP 5 do something like this:
          LoadModule php5_module “G:/PHP/php5apache2_2.dll”

    -> # Find section, add these lines
          AddType application/x-httpd-php .php
          AddType application/x-httpd-php .phtml
          -> # Find section, modify the line so it like this,
          DirectoryIndex index.html index.html.var index.php

    -> # at the end of the file, add these lines to tell Apache the path to php.ini
          PHPIniDir “G:/PHP”
4. create new file, phpinfo.php in the folder G:\Apache\htdocs\
    -> <?php
          phpinfo();
          ?>
5. try on browser
    -> http://localhost/phpinfo.php
you should see text,
    -> PHP Version 5.3.2 and it’s parameter info
================================================================================

================================================================================
INSTALL WEBSVN 2.3.1
================================================================================
1. unzip websvn-2.3.1.zip
    -> G:\WebSVN
2. on command prompt
G:\WebSVN>copy G:\WebSVN\include\distconfig.php G:\WebSVN\include\config.php /v
3. edit G:\WebSVN\include\config.php, add these lines
    -> $config->setSVNCommandPath(‘G:\\Subversion\\bin’);
          $config->parentPath(“G:/svnrepos”);
          $config->addTemplatePath($locwebsvnreal.’/templates/calm/’);
          $config->addTemplatePath($locwebsvnreal.’/templates/BlueGrey/’);
          $config->addTemplatePath($locwebsvnreal.’/templates/Elegant/’);
          $config->setTemplatePath($locwebsvnreal.’/templates/calm/’);
          $config->useTreeIndex(true);
          $config->useFlatView();
          $config->setAlphabeticOrder(true);
          $config->setDefaultLanguage(‘en’);
          $config->addInlineMimeType(‘text/plain’);
          $config->setMinDownloadLevel(2);
          set_time_limit(0);
          $config->expandTabsBy(8);
4. edit G:\Apache\conf\httpd.conf, add these lines
    -> # Find section, add these lines
          Alias /websvn/ “G:/webSVN”

    -> <Directory “G:/WebSVN”>
          AllowOverride None
          Order allow,deny
          Allow from all
          </Directory>

5. try on browser
    -> http://192.168.51.10/websvn/index.php
you should see text,
    -> Subversion Repositories…

Setting Password Authentication
——————————-
1. on command prompt,
    -> G:\mkdir G:\svnrepos\conf
          G:\G:\Apache\bin\htpasswd -c -m           G:\svnrepos\htpasswd harry [enter new password & re-type]
          G:\G:\Apache\bin\htpasswd -m           G:\svnrepos\htpasswd sally [enter new password & re-type]
          G:\G:\Apache\bin\htpasswd -m           G:\svnrepos\htpasswd ross [enter new password & re-type]
          G:\G:\Apache\bin\htpasswd -m           G:\svnrepos\htpasswd rachel [enter new password & re-type]
          G:\G:\Apache\bin\htpasswd -m           G:\svnrepos\htpasswd william [enter new password & re-type]

Enable SSL
———-
1. edit G:\Apache\conf\httpd.conf, find “mod_ssl.so”, uncomment the line
    -> LoadModule ssl_module modules/mod_ssl.so
2.

================================================================================

Indexing Tomcat Log File Format By Date

I want to change tomcat log file from this format “catalina.2010-05-17.log” to “2010-05-17.catalina.log”. With “date” as prefix, i can index the log file. But because prefix if remarked then the log file will add “juli.” as prefix, so i left prefix = .
To do that, here the steps,
1. Edit “logging.properties” file on [TOMCAT_HOME]/conf
2. Change some text like this

.
.
.
1catalina.org.apache.juli.FileHandler.prefix = .
1catalina.org.apache.juli.FileHandler.suffix = .catalina
.
.
.
2localhost.org.apache.juli.FileHandler.prefix = .
2localhost.org.apache.juli.FileHandler.suffix = .localhost
.
.
.
3manager.org.apache.juli.FileHandler.prefix = .
3manager.org.apache.juli.FileHandler.suffix = manager
.
.
.
4host-manager.org.apache.juli.FileHandler.prefix = .
4host-manager.org.apache.juli.FileHandler.suffix = .host-manager

Integrate Tomcat with Apache

I use Apache2.2 and apache-tomcat-6.0.26, so here these steps:

1. download mod_jk, you can find the latest version here
2. edit Apache httpd.conf, add :

# Load mod_jk
#mod_jk-1.2.30-httpd-2.2.3.so
LoadModule jk_module D:/oss/Apache2.2/modules/mod_jk.so

# Configure mod_jk
#
#JkWorkersFile D:/oss/apache-tomcat-6.0.26/conf/jk/workers.properties
#JkLogFile logs/mod_jk.log
#JkLogLevel info

JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkMount /*.jsp ajp13

#To be added at the end of your httpd.conf
#For using Tomcat auto-configure
Include D:/oss/apache-tomcat-6.0.26/conf/auto/mod_jk.conf

3. create file “workers.properties” to [TOMCAT_HOME]/conf

worker.list=ajp13w,wlb,jkstatus

#
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009

#
# Defining a load balancer
#

worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w

#
# Define status worker
#

worker.jkstatus.type=status

note:
– replace [TOMCAT_HOME] & [JAVA_HOME] to your local path

– for Apache 2, you don’t need AddModule mod_jk.c

– other related tips, click integrate tomcat with apache

Access to Tomcat server has not been authorized

For the first time, when I try to deploy a project using Netbeans, i got this message,

 

Deployment error:
Access to Tomcat server has not been authorized. Set the correct username and password with the “manager” role in the Tomcat customizer in the Server Manager.
See the server log for details.
After I googling, the solution,
– edit the content of C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\conf\tomcat-users.xml file.
-make sure you have role = manager and user that have manager role, like this
<tomcat-users>
<role rolename=”manager”/>
<role rolename=”standard”/>
<user username=”admin” password=”pwd” roles=”standard,manager”/>
</tomcat-users>
-save the file and restart Tomcat server