Target: Configure apache2.2 and tomcat 6 virtual hosts in Linux. In some cases, apache2.2 cannot forward requests to tomcat (for example, directly processing the display of static pages ), therefore, there is no way to differentiate between dynamic and static projects by using simple policies such as ajp proxy. In this regard, tomcat was prepared early and tomcat-connectors was launched for support.
Preliminary installation:
1. apache has been fully installed in the/usr/local/apache2.2 directory, and the web Service port is 80. Apache it works is started! Prompt
2. tomcat6 has been installed in the/usr/local/tomcat6 directory. Port 8009 development. The web Service port is 8080. After startup, It is the deployment page of tomcat.
I have deployed two jsp projects MicTrader and MicSeller under tomcat6 webapps. Pass
Http: // ip: 8080/MicTrader and http: // ip: 8080/MicSeller can access
3. jdk has been installed and the above two services are available
4. For linux RedHat4, the related compilation package is OK.
Download:
1. connector package: Apache Tomcat Connectors (mod_jk) 1.2.30 for Linux i586
Command: wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.30/i586/mod_jk-1.2.30-httpd-2.2.X.so
Note:
2. The downloaded so file name: mod_jk-1.2.30-httpd-2.2.X.so
Copy and rename the file to:/usr/local/apache2.2/modules/mod_jk.so
Grant the system read and write permissions to the file: cd/usr/local/apache2.2/modules
Chmod 777 mod_jk.so
3. Configure related files (back up one copy before the operation)
(1) Configure httpd. conf. Note: add by kongqz internally. I added them all. It mainly loads the mod_jk.so module and configures the virtual host.
#
# This is the main Apache HTTP server configuration file. It contains
# Configuration directives that give the server its instructions.
# See <URL: http://httpd.apache.org/docs/2.2> for detailed information.
# In particle, see
# URL: http://httpd.apache.org/docs/2.2/mod/directives.html>
# For a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# What they do. Theyre here only as hints or reminders. If you are unsure
# Consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for Example
# Of the servers control files begin with "/" (or "drive:/" for Win32),
# Server will use that explicit path. If the filenames do * not * begin
# With "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# With ServerRoot set to "/usr/local/apache2.2" will be interpreted by
# Server as "/usr/local/apache2.2/logs/foo_log ".
#
# ServerRoot: The top of the directory tree under which the servers
# Configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# At a local disk. If you want to share the same ServerRoot for multiple
# Httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr/local/apache2.2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# Ports, instead of the default. See also the <VirtualHost>
# Directive.
#
# Change this to Listen on specific IP addresses as shown below
# Prevent Apache from glomming onto all bound IP addresses.
#
# Listen 12.34.56.78: 80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# Have to place corresponding 'loadmodule lines at this location so
# Directives contained in it are actually available _ before _ they are used.
# Statically compiled modules (those listed by 'httpd-l) do not need
# To be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
# Add by kongqz 20101214
LoadModule jk_module modules/mod_jk.so
# AddModule mod_jk.c
Include/usr/local/apache2.2/conf/mod_jk.conf
<IfModule! Mpm_netware_module>
<IfModule! Mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# Httpd as root initially and it will switch.
#
# User/Group: The name (or