Install apache and configure tomcat in linux. For more information, see apachetomcat.
The following describes how to install apache in the Red hat enterprise linux5 environment. simply copy and paste the command and execute it.
Download idea
Or browse my resources. apache_all.zip. No resource score is required.
For example, if I put it under/Software by default, the directory will start.
Install apr
# Tar-zxf apr-1.5.1.tar.gz
# Cd apr-1.5.1
#./Configure -- prefix =/usr/local/apr
# Make & make install
Install APR-util
# Tar-zxf apr-util-1.5.4.tar.gz
# Cd apr-util-1.5.4
#./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr/bin/apr-1-config
# Make & make install
Install pcre
# Unzip-o pcre-8.36.zip
# Cd pcre-8.36
#./Configure -- prefix =/usr/local/pcre
# Make & make install
Install apache
# Tar-zxf httpd-2.4.10.tar.gz
# Cd httpd-2.4.10
#. /Configure -- prefix =/usr/local/apache2 -- enable-so -- with-apr =/usr/local/apr -- with-defined ded-apr -- with-apr-util =/ usr/local/apr-util/-- with-pcre =/usr/local/pcre
# Make & make install
Note:
When the -- with-passed ded-apr parameter is used, configure: error: Bundled APR requested but not found at./srclib/. error may be reported.
Copy apr and apr-util to httpd.
# Cd ..
# Cp-rf./apr-1.5.1./httpd-2.4.10/srclib/apr
# Cp-rf./apr-util-1.5.4./httpd-2.4.10/srclib/apr-util
To be conservative, run # make clean and then re-compile and install it.
Compile and generate mod_jk.
# Tar xzvf tomcat-connectors-1.2.40-src.tar.gz
# Cd tomcat-connectors-1.2.40-src/native
#./Configure -- with-apxs =/usr/local/apache2/bin/apxs
# Make
# Cp./apache-2.0/mod_jk.so/usr/local/apache2/modules/
Go to/usr/local/apache2/conf/to modify the apache configuration file. The tomcat worker mode is used to conveniently add, modify, and add clusters.
For a single application, you can directly use the proxy mode for forwarding. how to configure proxy is not described here.
Prepare to create three configuration files mod_jk.conf, jk. conf, and workers. properties.
Add mod_jk.conf
# Mod_jk.conf start
# Point out the location of the workers. properties file required for mod_jk module work
JkWorkersFile/usr/local/apache2/conf/workers. properties
# Where to put jk logs
JkLogFile/usr/local/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# 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"
# Mod_jk.conf end
Add worker. properties
Worker. list = tomcatGdxr, tomcatSdw
#------------------------
# First tomcat server
#------------------------
Worker. tomcatGdxr. port = 8009
Worker. tomcatGdxr. host = localhost
Worker. tomcatGdxr. type = ajp13
# Add jk. conf
<VirtualHost *: 80>
ServerName gdxinrong.cn here is your website domain name.
ServerAlias www.gdxinrong.cn domain name alias.
JkMount/* tomcatGdxr
</VirtualHost>
Edit httpd. conf # vi httpd. conf
Find the LoadModule list... for example:
LoadModule alias_module modules/mod_alias.so
The default location is: # LoadModule rewrite_module modules/mod_rewrite.so
Add:
LoadModule jk_module modules/mod_jk.so
Include/usr/local/apache2/conf/mod_jk.conf
Include/usr/local/apache2/conf/jk. conf
Modify the server. xml of tomcat. Note that the port conflict occurs. apache uses port 80 by default.
<Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443"/>
<! -- Add or modify a row of Engine. -->
<Engine name = "Catalina" defaultHost = "localhost" jvmRoute = "tomcatGdxr">
Others:
Configure: error: Bundled APR requested but not found at./srclib/. Download and unpack the corresponding apr and apr-util packages to./srclib /.
It means that you need to download apr and apr-utils and extract them to the./srclib/directory before compiling.
View source?
1
Cd/usr/local/src # Put the source code package in this directory
2
Http://apache.etoak.com/apr/apr-util-1.4.1.tar.gz wget-c
3
Http://apache.etoak.com/apr/apr-1.4.6.tar.gz wget-c
4
5
Tar-xzvf./apr-1.4.6.tar.gz
6
Tar-xzvf./apr-utli-1.4.1.tar.gz
7
Cp-rf./apr-1.4.6./httpd-2.4.6/srclib/apr
8
Cp-rf./apr-util-1.4.6./httpd-2.4.6/srclib/apr-util
# Re-execute the configure command,
Occasionally, re-make & make install may fail. You can try to execute make clean first to clear compiled objects.