Apache + Tomcat + php + mod_ssl + openssl + mysql 整合
The install packages which we need:
a) apache_1.3.33.tar.gz
b) jakarta-tomcat-4.1.31.tar.gz
c) jakarta-tomcat-connectors-4.1.31-src.tar.gz
d) jakarta-tomcat-connectors-jk-1.2.6-src.tar.gz
e) j2sdk1.4.2_05.tar.gz
f) mod_ssl-2.8.22-1.3.33.tar.gz
g) openssl-0.9.7e.tar.gz
h) mm-1.3.1.tar.gz
i) php-4.3.10.tar.gz
j) mysql-standard-4.1.8-pc-linux-i686.tar.gz
http://www.apache.org/dist
http://www.sun.com
http://www.modssl.org
http://www.openssl.org
http://www.ossp.org/pkg/lib/mm/
http://www.php.net
http://www.mysql.com
Save the packages in this directory: /usr/local/src/
#cd /usr/local/src/
Download the packages which we need:
wget http://www.apache.org/dist/httpd/apache_1.3.33.tar.gz
wget http://www.apache.org/dist/apr/apr-1.0.1.tar.gz
wget http://www.apache.org/dist/jakarta/tomcat-4/v4.1.31/bin/jakarta-tomcat-4.1.31.tar.gz
wget http://www.apache.org/dist/jakarta/tomcat-4/v4.1.31/src/jakarta-tomcat-connectors-4.1.31-src.tar.gz
wget http://www.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.6/jakarta-tomcat-connectors-jk-1.2.6-src.tar.gz
wget http://www.openssl.org/source/openssl-0.9.7e.tar.gz
wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.3.1.tar.gz
wget http://www.modssl.org/source/mod_ssl-2.8.22-1.3.33.tar.gz
wget http://cn.php.net/get/php-4.3.10.tar.gz/from/this/mirror
#tar -zvxf apache_1.3.33.tar.gz
#tar -zxvf openssl-0.9.7e.tar.gz
#tar -zxvf mm-1.3.1.tar.gz
#tar -zxvf mod_ssl-2.8.22-1.3.33.tar.gz
#tar -zxvf j2sdk-1_4_2_05.tar.gz
#tar -zxvf jakarta-tomcat-4.1.31.tar.gz
#tar -zxvf jakarta-tomcat-connectors-4.1.31-src.tar.gz
#tar –zxvf jakarta-tomcat-connectors-jk-1.2.6-src.tar.gz
#tar -zxvf apr-1.0.1.tar.gz
#tar –zxvf mysql-standard-4.1.8-pc-linux-i686.tar.gz
#tar -zxvf php-4.3.10.tar.gz
Install openssl, mm, modssl and Apache with all of the modules:
#cd openssl-0.9.7e
#./config --help
#./config -help
#./config \
--prefix=/usr/local \
no-threads
#make
#make test
#make install
#cd ..
#cd mm-1.3.1
#./configure --help
#./configure \
--disable-shared
#make
#make install
#cd ..
#cd mod_ssl-2.8.22-1.3.33
#./configure --help
#./configure \
--with-apache=../apache_1.3.33 \
--with-mm=../mm-1.3.1 \
--with-ssl=../openssl-0.9.7e \
--with-eapi-only
#cd ../apache_1.3.33
#SSL_BASE=../openssl-0.9.7e
#EAPI_MM=../mm-1.3.1
#./configure --help
#./configure \
--prefix=/usr/local/apache \
--enable-module=so \
--enable-module=ssl \
--enable-module=most \
--enable-rule=EAPI \
--enable-shared=max \
--enable-shared=ssl
#make
#make certificate VIEW=1
#make certificate
#make install
#make clean(make distclean)
#cd ..
#cd php-4.3.10
#./config –help
#./configure \
--with-apxs=/usr/local/apache/bin/apxs \
--with-openssl=/usr/local/ssl
#cd ..
#tar –zxvf mysql-standard-4.1.8-pc-linux-i686.tar.gz
#cp –r mysql-standard-4.1.8-pc-linux-i686 /usr/local/mysql
Install the jdk:
#tar -zvxf j2sdk1.4.2_05.tar.gz
#cp -r j2sdk1.4.2_05 /usr/local/
#cd ..
#ln -s j2sdk1.4.2_05 /usr/local/java
Install tomcat:
#tar -zvxf jakarta-tomcat-4.1.31.tar.gz
#cp -r jakarta-tomcat-4.1.31 /usr/local/
#cd ..
#ln -s jakarta-tomcat-4.1.31 tomcat
#cd /usr/local/tomcat/bin/
edit the file: Catalina.sh, add the underline:
JAVA_HOME=/usr/local/java
JAVA_OPTS="-Xms256m –Xmx512m"
CATALINA_HOME=/usr/local/tomcat
edit the file: /etc/profile, add the underline:
#java environment variable settings
JAVA_HOME=/usr/local/java/
export JAVA_HOME
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export CLASSPATH
CATALINA_BASE=/usr/local/tomcat
export CATALINA_BASE
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
#touch /etc/profile
#java –version
#
#cd /usr/local/src/
#tar -zxvf apr-1.0.1.tar.gz
#tar -zxvf jakarta-tomcat-connectors-4.1.31-src.tar.gz
#cp –r apr-1.0.1/ jakarta-tomcat-connectors-4.1.31-src/webapp/apr
#cd jakarta-tomcat-connectors-4.1.30-src/webapp/support/
#./buildconf.sh
#./configure \
–with-apxs=/usr/local/apache/bin/apxs
#make
#cd apache-1.3
#cp mod_webapp.so /usr/local/apache/libexec/
edit the file:/usr/local/apache/conf/httpd.conf
NameVirtualHost 192.168.1.10
<VirtualHost 192.168.1.10>
# ServerAdmin [email protected]
DocumentRoot /usr/local/apache/htdocs
ServerName 192.168.1.10
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
WebAppDeploy ROOT warpConnection /
</VirtualHost>
NameVirtualHost 192.168.1.11
<VirtualHost 192.168.1.11>
# ServerAdmin [email protected]
DocumentRoot /usr/local/apache/htdocs
ServerName 192.168.1.11
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
WebAppDeploy examples warpConnection /examples
</VirtualHost>
不作虚拟主机时可以使用以下内容:
WebAppConnection warpConnection warp 192.168.1.10:8008
#WebAppDeploy examples warpConnection /examples
WebAppDeploy ROOT warpConnection /
修改文件:/usr/local/tomcat/conf/server.xml
<!-- 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" />
<Host name="localhost" debug="0" appBase="/usr/local/jakarta-tomcat-4.1.30/webapps"
uppackWars="true" autoDeploy="true">
<Context path="/ROOT" docBase="ROOT" debug="0"/>
<Context path="/examples" docBase="examples" debug="0" privileged="true"/>
<!--
<Context path="/examples" docBase="/examples" debug="0" privileged="true"/>
<Context path="/jive" docBase="jive" debug="0"
reloadable="true" crossContext="true"/>
-->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="host1_log." suffix=".txt" timestamp="true"/>
</Host>
</Engine>
</Service>
4. Install tomcat connector
#tar -zvxf jakarta-tomcat-connectors-jk-1.2.6-src.tar.gz
#cd jakarta-tomcat-connectors-jk-1.2.6-src/jk/native/
#./buildconf.sh
# ./configure \
--enable-jni --enable-EAPI \
-with-apxs=/usr/local/apache/bin/apxs \
--with-java-home=/usr/local/java
# make
# cp apache-1.3/mod_jk.so.0.0.0 /usr/local/apache/libexec/mod_jk.so
# cd /usr/local/jakarta-tomcat-connectors-4.1.31-src/jk/conf
# cp workers.properties /usr/local/apache/conf
edit the file workers.properties:
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=\
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
# vi httpd.conf
in the bottom, add the following lines:
Port 80
ServerName localhost:80
LoadModule jk_module libexec/mod_jk.so
JkWorkersFile "/usr/local/apache/conf/workers.properties"
JkLogFile "/var/log/tomcat/tomcat_jk.log"
JkMount /* ajp13
JkMount /*.jsp ajp13
# cd /usr/local/tomcat/conf
#mv server.xml server.xml.bak
# cp server-noexamples.xml.config server.xml
#vi server.xml
Search 8009, in the connector, add the following lines:
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="4" connectionTimeout="20000" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_ajp_log." suffix=".txt" timestamp="true"/>
</Connector>
还有部分未完成,敬请期待!
本文地址:http://com.8s8s.com/it/it12360.htm