Apache2 + Tomcat5.0 integration in Linux

Source: Internet
Author: User
Tags 403 forbidden error
Apache2 + Tomcat5.0 integration in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Tomcat and JDK1.4.2 have been installed on the server.

Tomcat5.0 Directory:/home/oracle/tomcat

JDK 1.4.2 Directory:/home/oracle/j2sdk1.4.2 _ 07

Installation Steps of Tomcat5.0 and JDK1.42


Install Apache2.0.59 to/home/oracle/apache

Download httpd-2.0.59.tar.gz and upload it to/home/oracle.

Cd/home/oracle

Tar-zxvf httpd-2.0.59.tar.gz

Cd httpd-2.0.59

# Configuration (prefix is the installation path, and enable-mod-shared = all indicates compiling and configuring all so files)

./Configure -- prefix =/home/oracle/apache -- enable-mod-shared = all

Make

Make install


# Configure httpd. conf

Vi/home/oracle/apache/conf/httpd. conf



ServerName: 127.0.0.1, Server IP address or domain name

Define index.htm index. jsp in DirectoryIndex

DefaultLanguage is set to zh-CN



Cd/home/oracle/apache/bin



./Apachectl start



Open http: // 127.0.0.1/and see "test page for installing Apache". It indicates that Apache has been installed successfully.



If "403 Forbidden error" appears (and httpd. conf is not set to prohibit access), the solution is as follows:

You must not only set the WEB directory to readable, but also set all the parent directories of the WEB directory to at least searchable.



Chmod + x/home

Chmod + x/home/oracle

Chmod + x/home/oracle/apache

Chmod 777-R/home/oracle/apache/htdocs



Compile and set mod_jk2



In the http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/



Download jakarta-tomcat-connectors-jk2-src-current.tar.gz to/home/oracle



Tar zxvf jakarta-tomcat-connectors-jk2-src-current.tar.gz



Cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2



./Buildconf. sh



./Configure -- with-apxs2 =/home/oracle/apache/bin/apxs -- with-java-home =/home/oracle/j2sdk1.4.2 _ 07



Make jk2-build-apxs



Cd server/apache2



Make-f Makefile. apxs install



After completing these steps, mod_jk2 has been installed and the configuration phase is followed.



Create the workers2.properties file in the/home/oracle/apache/conf directory. The content is as follows:



# ---- Worker2.properties



[Logger. apache2]

Level = DEBUG



# Shared memory handling. Needs to be set.

[Shm]

File =/home/oracle/apache/logs/shm. file

Size = 1048576



# Example socket channel, explicitly set port and host.

[Channel. socket: localhost: 8009]

TomcatId = localhost: 8009

Port = 8009

Host = 127.0.0.1

# Define the worker

[Ajp13: localhost: 8009]

Channel = channel. socket: localhost: 8009



# [Status: status]



# Uri mapping



# [Uri:/jkstatus/*]

# Group = status: status



# [Uri:/jsp-examples/*]

# Group = ajp13: localhost: 8009



# [Uri:/servlets-examples/*]

# Group = ajp13: localhost: 8009



# [Uri:/javaapp/*]

# Group = ajp13: localhost: 8009



# [Uri: www.home.net/developer.jsp]

# Worker = ajp13: localhost: 8009



# [Uri: 10.0.0.10/*]

# Worker = ajp13: localhost: 8009



# [Uri:/*. do]

# Worker = ajp13: localhost: 8009



[Uri:/servlet/*]

Worker = ajp13: localhost: 8009



[Uri:/*. jsp]

Worker = ajp13: localhost: 8009



# ---- End of workers2.properties



Then add the virtual directory in httpd. conf.


NameVirtualHost *



ServerAdmin 123@126.com

DocumentRoot/usr/website/123/webapps/ROOT

ServerName www.123.com

ErrorLog logs/123-error_log

CustomLog logs/123-access_log common

ErrorDocument 404/error/404.html

ErrorDocument 401/error/401.html




Configure the conf/server. xml file in Tomcat

Change Tomcat port to 8080 to avoid conflict with apache

In

Add the Tomcat VM corresponding to the Apache VM


UnpackWARs = "true" autoDeploy = "true" xmlValidation = "false" xmlNamespaceAware = "false">


Now, Apache2 + Tomcat5 has been integrated in Linux!
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.