linux下整合apache和tomcat

2015-07-14 11:34

yum install php* httpd* tomcat* mysql*

wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/x86_64/mod_jk-1.2.31-httpd-2.2.x.so

mv mod_jk-1.2.31-httpd-2.2.x.so /etc/httpd/modules/mod_jk.so

chmod +x /etc/httpd/modules/mod_jk.so

vi /etc/httpd/conf/httpd.conf


在DirectoryIndex中添加 index.jsp index.php

------------------------------------------------------------

#for tomcat
include "/etc/httpd/conf/mod_jk.conf"

------------------------------------------------------------


vi /etc/httpd/conf/mod_jk.conf


------------------------------------------------------------

#Load mod_jk module
LoadModule jk_module modules/mod_jk.so
#Where to find workers.properties
JkWorkersFile conf/workers.properties
#Where to put jk logs
JklogFile 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"
#Send servlet for context /examples to worker named ajp13
#JkMount /servlet/* ajp13
#Send JSPs for context /examples to worker named ajp13
JkMount /*.jsp ajp13

-------------------------------------------------------------


vi /etc/httpd/conf/workers.properties


-------------------------------------------------------------

worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

-------------------------------------------------------------


vi /etc/tomcat6/server.xml


在HOST段中加入:

<Context path="" docBase="/var/www/html" debug="0" reloadable="true" crossContext="true"/>


vi /etc/php.ini

short_open_tag = On
post_max_size = 100M
upload_max_filesize = 100M
date.timezone =PRC


chkconfig iptables off

chkconfig php-fpm --level 35 on

chkconfig httpd --level 35 on

chkconfig tomcat6 --level 35 on

chkconfig mysqld --level 35 on