Install Apache under Linux and configure Tomcat. Super-detailed sharing.

Source: Internet
Author: User

Here is the detailed procedure for installing Apache in the Red Hat Enterprise LINUX5 environment. Basic copy-paste command to execute.

Download httpd-2.4.10.tar.gz,apr-1.5.1.tar.gz,apr-util-1.5.4.tar.gz,pcre-8.36.zip,tomcat-connectors-1.2.40-src.tar.gz

or browse my resources. Apache_all.zip. No resource points are required.

For example, I put the/software under the default. Then enter this directory to begin.



Install Apr
# TAR-ZXF Apr-1.5.1.tar.gz
# CD apr-1.5.1
#./configure--PREFIX=/USR/LOCAL/APR
# Make && make install


Installing 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


Installing Pcre
#unzip-O Pcre-8.36.zip
#cd pcre-8.36
#./configure--prefix=/usr/local/pcre
#make && make Install

Installing 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-included-apr--with-apr-util= /usr/local/apr-util/--with-pcre=/usr/local/pcre
# Make && make install


Attention:
Using the--WITH-INCLUDED-APR parameter may be reported configure:error:Bundled APR requested but not found at./srclib/. Error
You need to copy Apr and Apr-util to httpd inside.
#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, you can perform #make clean before recompiling the installation.

Compile the build 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/


Enter/usr/local/apache2/conf/to modify the Apache configuration file. Here is the pattern of using Tomcat worker. Easy to cluster, add and modify.
For a single application. You can use proxy mode directly. To forward. How to configure the proxy here is not detailed.
Ready to build three profiles mod_jk.conf, jk.conf, Workers.properties.

Add mod_jk.conf
#mod_jk. conf start
#指出mod_jk模块工作所需要的工作文件workers. Location of properties
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


# #添加 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 LoadModule List ... Such as:
LoadModule Alias_module modules/mod_alias.so
The default should be this location: #LoadModule rewrite_module modules/mod_rewrite.so

Add in the following:
LoadModule Jk_module modules/mod_jk.so
Include/usr/local/apache2/conf/mod_jk.conf
Include/usr/local/apache2/conf/jk.conf

Modify your Tomcat's server.xml and note port conflicts. Apache uses port 80 by default.
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<!--Add or modify an engine row .-->
<engine name= "Catalina" defaulthost= "localhost" jvmroute= "TOMCATGDXR" >

Other:
Configure:error:Bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and Apr-util packages to./srclib/.
It means: You need to download Apr and apr-utils and unzip it into the./srclib/directory, and then compile.
View Source?
1
CD/USR/LOCAL/SRC #源码包统一放到此目录
2
Wget-c http://apache.etoak.com/apr/apr-util-1.4.1.tar.gz
3
Wget-c http://apache.etoak.com/apr/apr-1.4.6.tar.gz
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
#重新执行 Configure command,
Occasionally, a re-make&&make install also fails. Try to do clean first. Clears the compiled object.

Install Apache under Linux and configure Tomcat. Super-detailed sharing.

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.