当前位置: 技术问答>linux和unix
Apache + tomcat + mod_jk 配置, 我这样做有问题吗?
来源: 互联网 发布时间:2016-10-02
本文导语: Apache + tomcat 整合已经做了有3天了。还是没有配置成功,郁闷ing... 环境如下:CentOS 5.5, JDK-1_5_0_22 Apache-2.2.16 tomcat-5.5.31 mod_jk-1.2.30-httpd-2.2.X.so Apache 80端口 /var/www/html/ tomcat 8080 /usr/local/tomcat-5.5.31/webapps/ROOT/ ...
Apache + tomcat 整合已经做了有3天了。还是没有配置成功,郁闷ing...
环境如下:CentOS 5.5, JDK-1_5_0_22
Apache-2.2.16
tomcat-5.5.31
mod_jk-1.2.30-httpd-2.2.X.so
Apache 80端口 /var/www/html/
tomcat 8080 /usr/local/tomcat-5.5.31/webapps/ROOT/
我的配置内容:
-------------------------------------------
Apache conf目录: /etc/httpd/conf/
httpd.conf
Include /etc/httpd/conf/mod_jk.conf
mod_jk.conf
LoadModule jk_module /usr/local/apache2/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkShmFile /var/log/httpd/mod_jk.shm
JkWatchdogInterval 60
# Inside Location we can omit the URL in JkMount
JkMount jk-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
# Inside Location we can omit the URL in JkMount
JkMount jk-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
# Inside Location we can omit the URL in JkMount
JkMount tomcatwork
Order deny,allow
Allow from all
JkMount /*.jsp tomcatwork
JkMount /servlet/* tomcatwork
workers.properties
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
# ..等等... jk-status,jk-manager 等都是默认有的,我没删过。下面开始是我的配置。
worker.list=tomcatwork
worker.tomcatwork.type=ajp13
worker.tomcatwork.host=localhost
worker.tomcatwork.port=8009
worker.tomcatwork.lbfactor=1
tomcat目录 /usr/local/tomcat-5.5.31/
/usr/local/tomcat-5.5.31/conf/server.xml
...
...
...
关于配置,我查了官网,也就这些吧。。
==============================
service httpd start 后,
[root@localhost common]# tail -n 2 /var/log/httpd/mod_jk.log
[Sat Sep 18 15:47:52.179 2010] [6461:3086334560] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Sat Sep 18 15:47:52.299 2010] [6462:3086334560] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[root@localhost common]#
jk 启动正常。
访问 http://localhost/Hello.jsp,提示 文件找不到。(Hello.jsp在tomcat的web目录)
访问 http://localhost:8080/Hello.jsp 正常。
环境如下:CentOS 5.5, JDK-1_5_0_22
Apache-2.2.16
tomcat-5.5.31
mod_jk-1.2.30-httpd-2.2.X.so
Apache 80端口 /var/www/html/
tomcat 8080 /usr/local/tomcat-5.5.31/webapps/ROOT/
我的配置内容:
-------------------------------------------
Apache conf目录: /etc/httpd/conf/
httpd.conf
Include /etc/httpd/conf/mod_jk.conf
mod_jk.conf
LoadModule jk_module /usr/local/apache2/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkShmFile /var/log/httpd/mod_jk.shm
JkWatchdogInterval 60
# Inside Location we can omit the URL in JkMount
JkMount jk-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
# Inside Location we can omit the URL in JkMount
JkMount jk-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
# Inside Location we can omit the URL in JkMount
JkMount tomcatwork
Order deny,allow
Allow from all
JkMount /*.jsp tomcatwork
JkMount /servlet/* tomcatwork
workers.properties
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
# ..等等... jk-status,jk-manager 等都是默认有的,我没删过。下面开始是我的配置。
worker.list=tomcatwork
worker.tomcatwork.type=ajp13
worker.tomcatwork.host=localhost
worker.tomcatwork.port=8009
worker.tomcatwork.lbfactor=1
tomcat目录 /usr/local/tomcat-5.5.31/
/usr/local/tomcat-5.5.31/conf/server.xml
...
...
...
关于配置,我查了官网,也就这些吧。。
==============================
service httpd start 后,
[root@localhost common]# tail -n 2 /var/log/httpd/mod_jk.log
[Sat Sep 18 15:47:52.179 2010] [6461:3086334560] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Sat Sep 18 15:47:52.299 2010] [6462:3086334560] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[root@localhost common]#
jk 启动正常。
访问 http://localhost/Hello.jsp,提示 文件找不到。(Hello.jsp在tomcat的web目录)
访问 http://localhost:8080/Hello.jsp 正常。
|
我用proxy_ajp整合过 还没用workers整合过 晚上回去 照你的来测试一遍
|
楼主你的jsp文件放哪了?
个人建议放/var/www/html下,然后~
# rm -rf /usr/local/tomcat-5.5.31/webapps/ROOT
# cd /usr/local/tomcat-5.5.31/webapps
# ln -s ../../../var/www/html ROOT
个人建议放/var/www/html下,然后~
# rm -rf /usr/local/tomcat-5.5.31/webapps/ROOT
# cd /usr/local/tomcat-5.5.31/webapps
# ln -s ../../../var/www/html ROOT
|
关注!说不好过几天可能就要用了
|
把/etc/sysconfig/selinux里的
SELINUX=enforcing
改成
SELINUX=disabled
然后执行命令 setenforce 0
SELINUX=enforcing
改成
SELINUX=disabled
然后执行命令 setenforce 0