gpt4 book ai didi

linux - Ubuntu 12.04 上带有 mod_jk 的 Tomcat 7 和 Apache2

转载 作者:行者123 更新时间:2023-11-28 23:30:10 30 4
gpt4 key购买 nike

我尝试在 Ubuntu 12.04 上使用 mod_jk 安装 Tomcat 7 和 Apache2,安装 tomcat 并测试工作正常后:

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

我安装并配置了 mod_jk :

sudo apt-get install libapache2-mod-jk

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

添加这个:

# 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

到/etc/apache2/workers.properties

在文件/etc/apache2/mods-available/jk.conf 中将 JkWorkersFile 属性更改为/etc/apache2/workers.properties

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

添加

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

重启服务器:

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

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

我遇到了这个错误:

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

我也有这个错误重启 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

最佳答案

不确定通配符解析实际上是如何完成的,我通常有两个 JkMounts:

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

(这可能是多余的,但我比你引用的声明更喜欢这个声明,它还包括 /tomcat-demo7 和其他路径)

此外,请确保您没有多个 VirtualHost 声明,并且只有特定主机名实际启用了 JkMount。确保您的 workers.properties 确实被读取(日志文件,或引入语法错误并确保它被识别)

关于linux - Ubuntu 12.04 上带有 mod_jk 的 Tomcat 7 和 Apache2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31501002/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com