Apache + Tomcat + Java

Configuring jdk

#step1

Downloading from below mention site

http://java.sun.com/javase/downloads/index_jdk5.jsp

Downloading .bin file for open source.

#step2

mkdir /home/test/setup/

chmod +x jdk file

./jdk 1.5.bin

SET JAVA_HOME

vi /etc/profile.d/allajava.sh


    export PATH=$PATH:/usr/java/bin
    export JAVA_BINDIR=/usr/java/bin
    export JAVA_ROOT=/usr/java
    export JAVA_HOME=/usr/java
    export JRE_HOME=/usr/java/jre
    export LIBXCB_ALLOW_SLOPPY_LOCK=1---->this line above Suse Linux
version 10.3


#The above file is used for Suse distros and for others use
/etc/profile (Note only append the export lines)

cd /usr/bin

mv java  javaorg

cd /usr

ln -s /home/test/setup/jdk (java-dir)  java

source /etc/profile.d/alljava.sh


echo $JAVA_HOME

#The above command should show the below path

/usr/java

#This is confirmed your JAVA  Path was set correct.


Configuring Tomcat

#step1:Download from below mention site

http://archive.apache.org/dist/jakarta/tomcat-5/v5.0.28/bin/

Extract tar file .

tar -zxvf <tomcat.tar.gz> 

#step3

cd <tomcat path /jakarta-dir/bin/

./catalina.sh run

#Now check the tomcat port

telnet localhost 8080




Connecting Apche and Tomcat On  windows & Linux

For Windows


Download from the following -:

1.      Apache 2.0.63    http://httpd.apache.org/download.cgi (download the
msi  installer)
2.       Tomcat 5.028   
http://archive.apache.org/dist/tomcat/tomcat-5/v5.0.28/bin/ (download
the zip)
3.       Jdk 1.5          


Install Apache and check  http://localhost 


JAVA_HOME should be set before installing tomcat, 

Install Jdk 1.5 and set both user and system  variable   

#Go to Mycomputer  --> Properties --> Advanced --> Environment Variables 

Add in both user &  system
 JAVA_HOME 
C:\ProgrammeFiles/java/jdk1.5.0_16


then install  tomcat ()  and  check http://localhost:8080

For development, using the built-in http connector in Tomcat is
sufficient. For production, though, you'll probably want to put Tomcat
behind a web server like Apache. This document explains how to
configure the mod_jk and mod_jk2 connectors for connecting Tomcat and
Apache.


Two ways for connecting  apache with tomcat

1.Using jk module
2.Using proxy module

First Way using jk module

Download mod_jk  from   
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.27/
             (mod_jk-1.2.27-httpd-2.2.10.so)

 rename the module to   mod_jk.so and move to the modules dir  of 
apache   
     (C:/ProgrammeFiles/Apachegroup/Apache2/modules  )

edit your httpd.conf  and append the following

LoadModule   jk_module  modules/mod_jk.so (append this to loadmodules
directives exists)


Append the following at the end of the file


<IfModule mod_jk2.c>
#-----------------------------------------------
# Location of the workers2.properties file
#-----------------------------------------------
#
JkSet config.file APACHE_HOME/conf/workers.properties

JkWorkersFile "C:/Apache Software
Foundation/Apache2.2/conf/workers.properties"

# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# 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"

</IfModule>

OR

# mod_jk configuration

JkWorkersFile "conf/workers.properties"
JkLogFile     "logs/jk.log"
JkLogLevel    error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat     "%w %V %T"

# end mod_jk configuration
************************************************************************
Create workers.properties  under
C:/ProgrammeFiles/Apachegroup/Apache2/conf/
and append the following to that file

# Define 1 real worker using ajp13
  worker.list=worker1
  # Set properties for worker1 (ajp13)
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8009
  worker.worker1.connection_pool_size=100
  worker.worker1.connection_pool_timeout=10


Try the following default context

Uncomment the following  in D:\Program Files\Apache Software
Foundation\Apache2.2\conf\httpd.conf

Include conf\extra\httpd-vhosts.conf  (line no 388)

Append to http-vhost file  (D:\Program Files\Apache Software
Foundation\Apache2.2\conf\extra\httpd-vhost.conf)

For testing 

<VirtualHost *:80>

    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot  D:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\jsp-examples
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>


Alias /jsp-examples  D:\Program Files\Apache Software
Foundation\Tomcat 5.5\webapps\jsp-examples (define tomcat  home)
<Directory D:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\jsp-examples>
Allow From All
</Directory>
# Send JSPs for context /jsp-examples to worker named default
JkMount /jsp-examples/* worker1
# Send servlets-examples to worker named default
JkMount /servlets-examples/* worker1


Now Try the following

http://localhost/jspexamples

If ur jsp-examples page is displayed then u have successfully
connected apache and tomcat 




FOR LINUX 


Download mod_jk  from  
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.27/i386/

 rename the module to   mod_jk.so and move to the modules dir  of 
apache   
    /usr/local/apache2/modules

edit your httpd.conf  and append the following below LoadModule directive

LoadModule   jk_module  modules/mod_jk.so (append this to loadmodules
directives exists)


Append the following at the end of the file

<IfModule mod_jk2.c>
#-----------------------------------------------
# Location of the workers2.properties file
#-----------------------------------------------
#
JkSet config.file APACHE_HOME/conf/workers.properties

JkWorkersFile "C:/Apache Software
Foundation/Apache2.2/conf/workers.properties"

# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# 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"

</IfModule>

OR

# mod_jk configuration

JkWorkersFile "conf/workers.properties"
JkLogFile     "logs/jk.log"
JkLogLevel    error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat     "%w %V %T"

# end mod_jk configuration

For testing 

Uncomment the following in  /usr/local/apache2/conf/httpd.conf 
Include conf/extra/httpd-vhosts.conf  (line no 388)

Append the following  to httpd-vhost file  
(/usr/local/apache2/conf/extra/httpd-vhost.conf)

<VirtualHost *:80>

    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>


Alias /jsp-examples  /opt/tomcat/webapps/jsp-examples  (define tomcat
 home)
<Directory /opt/tomcat/webapps/jsp-examples>
Allow From All
</Directory>
# Send JSPs for context /jsp-examples to worker named default
JkMount /jsp-examples/* worker1
# Send servlets-examples to worker named default
JkMount /servlets-examples/* worker1

Create workers.properties  under /usr/local/apache2/conf/   
 Append the following to that file
 
# Define 1 real worker using ajp13
  worker.list=worker1
  # Set properties for worker1 (ajp13)
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8009
  worker.worker1.connection_pool_size=100
  worker.worker1.connection_pool_timeout=10

http://localhost/jsp-examples
If ur jsp-examples page is displayed then u have successfully
connected apache and tomcat 


Second Way Using ProxyPass for windows will post later

Any querry feel  free to call 

B.Sadhiq
09819493017





--- In [email protected], anil jarodia <[EMAIL PROTECTED]> wrote:
>
> hi,
> 
>        please any one help me how to configure httpd 2.2 with
apache-tomcat 5.0. i had installed both on server.
> but how to link them. also i want to install php.
> 
> Thanks & Regards
> Anil Jarodia
> 
> 
> 
>       Be the first one to try the new Messenger 9 Beta! Go to
http://in.messenger.yahoo.com/win/
> 
> [Non-text portions of this message have been removed]
>







--- In [email protected], anil jarodia <[EMAIL PROTECTED]> wrote:
>
> hi,
> 
>        please any one help me how to configure httpd 2.2 with
apache-tomcat 5.0. i had installed both on server.
> but how to link them. also i want to install php.
> 
> Thanks & Regards
> Anil Jarodia
> 
> 
> 
>       Be the first one to try the new Messenger 9 Beta! Go to
http://in.messenger.yahoo.com/win/
> 
> [Non-text portions of this message have been removed]
>


Reply via email to