# tar xzvf httpd-2.2.17.tar.gz? //解壓安裝文件 # cd httpd-2.2.17 # ./configure --prefix=/usr/local/apache2 --enable-so //安裝apache到/usr/local目錄下 # make # make install
4、安裝Tomcat。
# cp apache-tomcat-6.0.32.tar.gz /usr/local/ # cd /usr/local # tar xzvf apache-tomcat-6.0.32.tar.gz??? # mv apache-tomcat-6.0.32 tomcat6
# tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz # cd jakarta-tomcat-connectors-1.2.15-src/jk/native # ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/java/jdk1.6.0_13 # make
# 指出mod_jk模塊工作所需要的工作文件workers.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" # 將所有servlet 和jsp請求通過ajp13的協議送給Tomcat,讓Tomcat來處理 JkMount /servlet/*? worker1 JkMount /*.jsp worker1
#JkMount *.action Worker1
#JkMount *.do?Worker1
# vi workers.properties
添加以下內容:
# Defining a worker named worker1 and of type ajp13 worker.list=worker1 # Set properties for worker1 worker.worker1.type=ajp13? worker.worker1.host=localhost? worker.worker1.port=8009 worker.worker1.lbfactor=50? worker.worker1.cachesize=10? worker.worker1.cache_timeout=600? worker.worker1.socket_keepalive=1? worker.worker1.socket_timeout=300
再配置httpd.conf,作以下修改:
將Listen 80 修改為 Listen 127.0.0.1:80
將ServerName 修改為 ServerName LocalHost:80
在DirectoryIndex中添加 index.jsp
我的網頁放在/var/wwwroot下,所以要修改DocumentRoot
DocumentRoot "/var/wwwroot"
Options Includes FollowSymLinks AllowOverride None Order deny,allow Allow from all XBitHack on
???? Order deny,allow Deny from all
增加關于加載mod_jk的語句:
LoadModule jk_module modules/mod_jk.so Include /usr/local/apache2/conf/mod_jk.conf