Use tomact + apache to combine dynamic and static web pages

Source: Internet
Author: User

1. About Tomact


1. tomact is a core project of the apache Software Foundation. Developed by apache, SUN, and other companies and individuals. tomact is an open-source Java-based Web Application Software container that runs servlet and JSP Web applications ;; tomact is a small lightweight application server. It is suitable for small and medium-sized systems or when there are not many users.

@ 1. servelet: server + applet server-side applet

@ 2. servelet container: Manage and run servelet containers.

Advantage: it can handle dynamic pages well and is good across platforms. JSP

Disadvantage: the processing of static pages is slow, and the configuration file is not configurable.


2. JSP: an application that uses java as a scripting language to serve http


3. install the software package required by tomcat

Apache-tomcat-6.0.16.tar.gz

Jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz

Jdk-1_5_0_16-linux-i586.bin

JiveForumsPro4_crack.tar.gz

Mysql-connector-java-3.1.14.tar.gz

II. Specific Configuration

1. Deploy the java environment

1. Install

[Root @ tx1 ~] # Chmod + x jdk-1_5_0_16-linux-i586.bin

[Root @ tx1 ~] # Cp-ajdk1.5.0 _ 16 // usr/local/java

2. Configure java environment variables

[Root @ tx1 ~] # Vim/etc/profile // set some path

JAVA_HOME =/usr/local/java

PATH = $ JAVA_HOME/bin: $ PATH

CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar

Export JAVA_HOME PATH CLASSPATH


[Root @ tx1 ~] #./Etc/profile // restart the configuration file

[Root @ tx1 ~] # Java-version // view the java version

Java version "1.5.0 _ 16"

[Root @ tx1 tmp] # vim hello. java

Public class hello {

Public static void main (String [] args ){

System. out. println ("hello all ");

}

}

[Root @ tx1 tmp] # javac hello. java

[Root @ tx1 tmp] # java hello

Hello all


2. Install tomact

(1) Extract

[Root @ tx1 ~] # Tar zxvf apache-tomcat-6.0.16.tar.gz

[Root @ tx1 ~] # Cp-aapache-tomcat-6.0.16/usr/local/tomcat

(2) define tomcat environment variables:

[Root @ tx1 ~] # Vim/etc/profile

CATALINA_BASE =/usr/local/tomcat

CATALINA_HOME =/usr/local/tomcat

PATH = $ CATALINA_HOME/bin: $ PATH

Export CATALINA_BASE CATALINA_HOME PATH

[Root @ tx1 ~] #./Etc/profile

[Root @ tx1 bin] # pwd

/Usr/local/tomcat/bin

[Root @ tx1 bin] # startup. sh // start the service

Using CATALINA_BASE:/usr/local/tomcat

Using CATALINA_HOME:/usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:/usr/local/java

Test

3. install java Forum

[Root @ tx1] # tar zxvf JiveForumsPro4_crack.tar.gz

[Root @ tx1 ~] # Cp-ajive // usr/local/tomcat/webapps/

4. Install mysql

[Root @ tx1 ~] # Yum install-y mysql-server

[Root @ tx1 ~] #/Etc/init. d/mysqld restart

[Root @ tx1 ~] # Mysqladmin-u root password 123

[Root @ tx1 ~] # Mysql-u root-p

Enter password:

ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)

[Root @ tx1 ~] # Mysql-u root-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or \ g.

Your MySQL connection id is 4

Server version: 5.0.77 Source distribution


Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.


Mysql> create database jivedb; // create a database

Query OK, 1 row affected (0.00 sec)


Mysql> grant all on jivedb. * to jiveuser @ localhost identified by "123456 ";

Query OK, 0 rows affected (0.00 sec)


Mysql> flush privileges; // update Permissions

Query OK, 0 rows affected (0.00 sec)


Mysql> quit

Bye

[Root @ tx1 ~] # Cd/usr/local/tomcat/webapps/jive/database

[Root @ tx1 database] # mysql-u root-p jivedb <jive_forums_mysql. SQL

Enter password:

[Root @ tx1 database] #

Install the mysql driver

[Root @ tx1 ~] # Tar zxvf mysql-connector-java-3.1.14.tar.gz

[Root @ tx1 ~] # Cd mysql-connector-java-3.1.14

[Root @ tx1 mysql-connector-java-3.1.14] # cp mysql-connector-java-3.1.14-bin.jar/usr/local/tomcat/lib/

Restart tomcat:


[Root @ tx1 ~] #./Etc/profile

[Root @ tx1 ~] # Shutdown. sh

Using CATALINA_BASE:/usr/local/tomcat

Using CATALINA_HOME:/usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:/usr/local/java


[Root @ tx1 ~] # Startup. sh

Using CATALINA_BASE:/usr/local/tomcat

Using CATALINA_HOME:/usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:/usr/local/java


Iii. Connection between apache and tomcat

[Root @ tx1 ~] # Tar zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz

[Root @ tx1 ~] # Cp-r jakarta-tomcat-connectors-jk2-2.0.4-src/usr/local/tomcat-connect

[Root @ tx1 ~] # Cd/usr/local/tomcat-connect/jk/native2

The compilation module is required: apxs

Httpd-devel --> apxs

[Root @ tx1 ~] # Yum install-y httpd-devel

[Root @ tx1 native2] # which apxs

/Usr/sbin/apxs

[Root @ tx1 native2] pwd

/Usr/local/tomcat-connect/jk/native2

[Root @ tx1 native2] #./configure -- with-apxs2 =/usr/sbin/apxs

Configure: error: C ++ preprocessor "/lib/cpp" fails sanity check

See 'config. log' for more details. // Error !!!

Solution

[Root @ tx1 ~] # Yum install gcc *-y

[Root @ tx1 native2] #./configure -- with-apxs2 =/usr/sbin/apxs

[Root @ tx1 native2] # make

[Root @ tx1 native2] # make install

Make: *** No rule to make target 'install'. Stop. // Error !!!

Solution

[Root @ tx1 native2] # cd/usr/local/tomcat-connect/jk/build/jk2/apache2

[Root @ tx1 apache2] # cp mod_jk2.so/etc/httpd/modules/

Modify the apache configuration file and add the newly compiled modules to it:

[Root @ tx1 apache2] # vim/etc/httpd/conf/httpd. conf

200 LoadModule jk2_module modules/mod_jk2.so

[Root @ tx1 apache2] # cp/usr/local/tomcat-connect/jk/conf/workers2.properties/etc/httpd/conf/

[Root @ tx1 apache2] # vim/etc/httpd/conf/workers2.properties

[Uri:/jive/*]

Info = map the tomcat

[Uri:/manager/*]

Info = map the tomcat

[Uri:/*. jsp]

Info = map the tomcat

[Root @ tx1 apache2] #/etc/init. d/httpd restart

Stopping httpd: [OK]

Starting httpd: [OK]

[Root @ tx1 apache2] # shutdown. sh

Using CATALINA_BASE:/usr/local/tomcat

Using CATALINA_HOME:/usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:/usr/local/java

[Root @ tx1 apache2] # startup. sh

Using CATALINA_BASE:/usr/local/tomcat

Using CATALINA_HOME:/usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:/usr/local/java

Test: If you use port 80 to access the jive forum, the operation is successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.