1.安装文件
apache-tomcat-6.0.35.tar.gz
httpd-2.2.22.tar.gz
tomcat-connectors-1.2.23-src.tar.gz
2.安装步骤
1.上传apache-tomcat-6.0.35.tar.gz到/opt/sudytech
执行
#tar -xzvf apache-tomcat-6.0.35.tar.gz
解压出目录
apache-tomcat-6.0.35
启动,测试是否安装成功
[root@localhost sudytech]# /opt/sudytech/apache-tomcat-6.0.35/bin/startup.sh
Using CATALINA_BASE: /opt/sudytech/apache-tomcat-6.0.35
Using CATALINA_HOME: /opt/sudytech/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /opt/sudytech/apache-tomcat-6.0.35/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/sudytech/apache-tomcat-6.0.35/bin/bootstrap.jar
访问:http://127.0.0.1:8080/
如果不能访问,查看是不是开启了防火墙,关闭即可.
[root@localhost sudytech]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
3 ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
6 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
8 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
10 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
[root@localhost sudytech]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[root@localhost sudytech]#
启动成功后,关闭tomcat进行下一步安装
[root@localhost sudytech]# /opt/sudytech/apache-tomcat-6.0.35/bin/shutdown.sh
Using CATALINA_BASE: /opt/sudytech/apache-tomcat-6.0.35
Using CATALINA_HOME: /opt/sudytech/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /opt/sudytech/apache-tomcat-6.0.35/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/sudytech/apache-tomcat-6.0.35/bin/bootstrap.jar
2.上传httpd-2.2.22.tar.gz到/opt/soft
[root@localhost sudytech]# tar -xzvf httpd-2.2.22.tar.gz
[root@localhost sudytech]# cd httpd-2.2.22
[root@localhost httpd-2.2.22]# ./configure --prefix=/opt/sudytech/apache2
[root@localhost httpd-2.2.22]#make
[root@localhost httpd-2.2.22]#make install
3.上传tomcat-connectors-1.2.23-src.tar.gz到/opt/soft
[root@localhost sudytech]# tar -xzvf tomcat-connectors-1.2.23-src.tar.gz
[root@localhost sudytech]# cd tomcat-connectors-1.2.23-src/native
[root@localhost native]# ./configure --prefix=/opt/sudytech/tomcat-connector --with-apxs=/opt/sudytech/apache2/bin/apxs
[root@localhost native]# make
[root@localhost native]# make install
在/opt/sudytech/apache2/modules/ 下会产生mod_jk.so
4.配置httpd.conf
内容如下
-----------------------------------------------------------
# 加载 mod_jk 模块
LoadModule jk_module modules/mod_jk.so
Include conf/mod_jk.conf
-----------------------------------------------------------
创建mod_jk.conf
内容如下
-------------------------------------------------------
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JKMount /*.jsp worker1
-------------------------------------------------------
接下来我们在 Apache 的 conf 目录下新建两个文件分别是 workers.properties、uriworkermap.properties(可省略)
内容如下
-----------------------------------------------------------
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
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
-----------------------------------------------------------
附录1:httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin yakson@nj-jz.com
DocumentRoot /opt/sudytech/t.hijor.com
ServerName www.nj-jz.com
ErrorLog logs/www.nj-jz.com-error_log
CustomLog logs/www.nj-jz.com-access_log common
RewriteEngine on
<Directory /opt/sudytech/t.hijor.com>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin yakson@nj-jz.com
DocumentRoot /opt/sudytech/ftproot/nj-jz
ServerName nj-jz.com
ErrorLog logs/nj-jz.com-error_log
CustomLog logs/nj-jz.com-access_log common
RewriteEngine on
<Directory /opt/sudytech/ftproot/nj-jz>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>