Integration of apache-2.0.43 and tomcat-4.1.12

Source: Internet
Author: User
Tags apache access log
Article title: apache-2.0.43 and tomcat-4.1.12 integration. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: luyongshou
This section describes how to integrate Apache with Tomcat 4 under RedHat Linux 7.2, focuses on how to create mod_webapp.so, and how to configure, manage, and apply it in a virtual host environment, the test has been successful. I hope it will help you. please correct me if you have any errors.
  
  
1. install Tomcat 4 correctly
Install necessary software as follows:
1. Java SDK
For version 1.3.1 or 1.4, it is recommended to install it in/usr/java and create a soft link for jdk.
If there is a problem installing SDK 1.3.1, read the documentation: http://java.sun.com/j2se/1.3/install-linux-sdk.html
2. Tomcat4
We recommend that you install the binary file installation package of the latest release version. The latest tomcat version is 4.1.12.
:
Http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/bin/jakarta-tomcat-4.1.12.tar.gz
Download and press to a directory "tar xvzf jakarta-tomcat-4.1.12.tar.gz"
In this example, tomcat is installed in the/opt directory and a soft link of tomcat is made.
Set and enable the following environment variables:
PATH = $ PATH:/usr/java/jdk/bin:/usr/java/jdk/jre/bin
JAVA_HOME =/usr/java/jdk
Export JAVA_HOME
CLASSPATH = "./:/usr/java/jdk/lib:/usr/java/jdk/jre/lib"
Export CLASSPATH
CATALINA_HOME =/opt/tomcat
Export CATALINA_HOME
  
We recommend that you create a single user tomcat, set it to the owner of all Directory files under/opt/tomcat, and start tomcat by it:
# Useradd tomcat
# Chown-R tomcat: tomcat/opt/tomcat
# Su-tomcat-c "/opt/tomcat/bin/startup. sh"
  
Visit http: // localhost: 8080/to see the successful tomcat installation page.
  
  
========================================================== ======================================
If you want to integrate with apache, you need to modify the tomcat/conf/server. xml file
  
  
  
  
  
  
  
" "Deleting is actually removing comments, because this website is specially used for integration with apache.
  
II. Integration of Apache and Tomcat 4
  
1. first install Apache,
Note that DSO mode must be installed in Apache, that is, -- enable-module = so must be added when you execute./configure.
  
Installed in the/usr/local/apache directory by default. The apache version installed in this example is 2.0.43 series.
  
2. create mod_webapp.so
The following software packages are required:
Jakarta-tomcat-connectors-4.x.xx-src.tar.gz
In the src Directory of the tomcat version. For example, if the tomcat version I installed is 4.1.12, the required software package is located:
Http://jakarta.apache.org/builds/ja...1.12-src.tar.gz
Apr-0.9.1.tar.gz
: Http://www.apache.org/dist/apr/apr-0.9.1.tar.gz
Autoconf-2.52-ximian.1.i386.rpm
: Http://rpmfind.net/linux/RPM/helix/...ian.1.i386.html
First use rpm to install the autoconf-2.52, because the following installation will be used;
Then open jakarta-tomcat-connectors-4.1.12-src.tar.gz and generate the jakarta-tomcat-connectors-4.1.12-src directory,
Go to the jakarta-tomcat-connectors-4.1.12-src/webapp's directory and remove apr-0.9.1.tar.gz to this directory,
And change the directory name of the directory apr-0.9.1 just generated to apr.
In the webapp Directory, run the following command:
# Support/buildconf. sh
In this case, if autoconf is earlier than 2.52, an error is reported and exited, so you must install the autoconf-2.52 first.
After the command is completed successfully, the configure file is generated in the current directory.
Run the following commands in sequence:
  
#./Configure -- with-apxs =/usr/local/apache/bin/apxs
# Make
# Cp apache-2.0/mod_webapp.so/usr/local/apache/modules
  
Now mod_webapp.so has been created and copied to the modules directory of apache.
Edit the apache configuration file and add the following lines at the end:
======================================
LoadModule webapp_module modules/mod_webapp.so
WebAppConnection Connector warp localhost: 8008
WebAppDeploy examples Connector/examples
======================================
  
Run the following command:
#/Usr/local/apache/bin/apachectl configtest
  
If an error occurs, the following error occurs: "inviad virual host"
  
It means that the ServerName of your httpd. conf is not set. remove "#" before the ServerName! (This is the answer only after a lot of information is provided. I am also confused here for many days)
  
"Syntax OK" indicates that mod_webapp.so has been installed successfully.
Start apache
#/Usr/local/apache/bin/apachectl start
Visit http: // localhost/examples to see the tomcat example program.
  
Note: you must first start tomcat and then restart apache!
  
III. configuration, management, and application under virtual hosts
  
The following uses an example to describe how a VM uses Apache and Tomcat 4 at the same time.
  
The directory structure of host1 is as follows:
  
  
/Www
| --- Main directory of host1
| -- Htdocs common root directory: used to display static pages or php programs
| ---- Logs apache access log
| ---- Webapps java Application Directory (newly added, not associated with tomcat's webapps directory)
| -- ROOT jsp ROOT directory: used to display jsp page programs
| ---- Jive a set of java application instances
| --- Main directory of host2
............
  
  
  
The original apache configuration file is configured as follows:
  
  
============================================
NameVirtualHost xxx. xxx
  
<VirtualHost xxx. xxx>
ServerName host1.mydomain.com
ServerAdmin webmaster@mydomain.com
DocumentRoot/www/host1/htdocs
ErrorLog/www/host1/logs/error_log
CustomLog/www/host1/logs/access_log common
</VirtualHost>
.............
  
============================================
  
  
  
To enable the virtual host host1 to use Apache and Tomcat 4 at the same time, you need to configure the following:
  
1. edit the tomcat configuration file server. xml and make the following changes in the last part:
  
  
============================================
<! -- Define an Apache-Connector Service -->
  
<Service name = "Tomcat-Apache">
  
<Connector className = "org. apache. catalina. connector. warp. WarpConnector"
Port = "8008" minProcessors = "5" maxProcessors = "75"
EnableLookups = "true" appBase = "webapps"
AcceptCount = "10" debug = "0"/>
  
<Engine className = "org. apache. catalina. connector. warp. WarpEngine"
Name = "Apache" debug = "0">
  
<Logger className = "org. apache. catalina. logger. FileLogger"
Prefix = "apache_log." suffix = ". txt"
Timestamp = "true"/>
  
<Realm className = "org. apache. catalina. realm. MemoryRealm"/>
  
<! -- The following is the newly added content -->
  
<Host name = "host1.mydomain.com" debug = "0" appBase = "/www/host1/webapps"
UppackWars = "true" autoDeploy = "true">
<Context path = "" docBase = "ROOT" debug = "0"/>
<! -- The following is a built-in tomcat management page, which can also be used under a VM -->
<Context path = "/manager" debug = "0" privileged = "true"
DocBase = "/opt/tomcat/server/webapps/manager"/>
<Context path = "/jive" docBase = "jive" debug = "0"
Reloadable = "true" crossContext = "true"/>
<Logger className = "org. apache. catalina. logger. FileLogger" <
Related Article

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.