简体   繁体   English

在Ubuntu 12.04上使用mod_jk的Tomcat 7和Apache2

[英]Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04

I tried to install Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04, after installing tomcat and test that works fine: 我安装了tomcat并测试正常后,尝试在Ubuntu 12.04上使用mod_jk安装Tomcat 7和Apache2。

http://139.162.221.XXX:8080/tomcat-demo/helloworld/ http://139.162.221.XXX:8080/tomcat-demo/helloworld/

I installed and configured mod_jk : 我安装并配置了mod_jk:

sudo apt-get install libapache2-mod-jk

uncomment the following line <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> in the file etc/tomcat7/server.xml 在文件etc / tomcat7 / server.xml中取消注释以下行<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

add this: 添加:

# Define 1 real worker using ajp13 
worker.list=worker1 
# Set properties for worker (ajp13) 
worker.worker1.type=ajp13 
worker.worker1.host=localhost
worker.worker1.port=8009

to /etc/apache2/workers.properties 到/etc/apache2/workers.properties

change the JkWorkersFile property to /etc/apache2/workers.properties in the file /etc/apache2/mods-available/jk.conf 将文件/etc/apache2/mods-available/jk.conf中的JkWorkersFile属性更改为/etc/apache2/workers.properties

edit the file: /etc/apache2/sites-enabled/000-default 编辑文件:/ etc / apache2 / sites-enabled / 000-default

to add 加上

<VirtualHost *:80>
.......................................
.......................................
JkMount /tomcat-demo/* worker1
JkMount /tomcat-demo worker1
</VirtualHost *:80>

restart the servers: 重新启动服务器:

sudo /etc/init.d/tomcat7 restart
sudo /etc/init.d/apache2 restart

but accessing to http://139.162.221.XXX/tomcat-demo/helloworld/ 但正在访问http://139.162.221.XXX/tomcat-demo/helloworld/

I got this error: 我收到此错误:

Not Found

The requested URL /tomcat-demo/helloworld/ was not found on this server.

Apache/2.4.7 (Ubuntu) Server at 139.162.221.107 Port 80

and I have also this error restart Apache: 而且我也有此错误重新启动Apache:

 * Restarting web server apache2                                                                                                                                 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message

Not sure how the wildcard resolution actually is done, I typically have two JkMounts: 不确定通配符解析的实际操作方式,我通常有两个JkMounts:

JkMount /tomcat-demo   worker1
JkMount /tomcat-demo/* worker1

(This might be superfluous, but I like this declaration better than the one you quote, which would also include /tomcat-demo7 and other paths) (这可能是多余的,但我比您引用的声明更喜欢此声明,该声明还包括/tomcat-demo7和其他路径)

Also, make sure you don't have multiple VirtualHost declarations and only a certain host name actually has the JkMount active. 另外,请确保没有多个VirtualHost声明,并且只有某个主机名实际上具有JkMount活动状态。 Make sure that your workers.properties is actually read (log files, or introduce syntax error and make sure that it's recognized) 确保您的worker.properties实际上已被读取(日志文件,或引入语法错误并确保已被识别)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM