我正在尝试使用 Apache HTTP Server 配置 tomcat 7,但它不起作用。
Tomcat 正常运行于http://127.0.0.1:8085
I have installed `mod_jk`:
aptitude install libapache2-mod-jk
我的workers.properties文件:
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
jk.conf 文件位于/etc/apache2/mods-available/jk.conf
:
JkWorkersFile /etc/apache2/workers.properties
JkShmFile /var/log/apache2/mod_jk.shm
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
要启用 kj,输出a2enmod jk
:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LC_PAPER = "en_US.UTF-8",
LC_ADDRESS = "en_US.UTF-8",
LC_MONETARY = "en_US.UTF-8",
LC_NUMERIC = "en_US.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_TIME = "en_US.UTF-8",
LC_NAME = "en_US.UTF-8",
LANG = "fr_FR.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("fr_FR.UTF-8").
Module jk already enabled
然后 apache2/site-available/000-default.conf 包含一行:
<VirtualHost *:80>
..
JkMount /tomcat7/* worker1
</VirtualHost>
tomcat7/server.xml 中的以下内容已取消注释:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
完成所有这些后,tomcat7 和 apache2 都会重新启动,并且
http://host.com/tomcat7
给出 404 并且我期望 Tomcat7 页面
我使用 apache 网络服务器配置 tomcat7 时出错了吗?
答案1
有时设置 ajp13_worker 比较棘手。但您的配置对我来说是正确的。
你已经尝试打开了http://host.com/tomcat7/索引.jsf(或 jsp 或 your_file_name)?您是否在 webapp 的 web.xml 中设置了欢迎文件?否则它不起作用。
./Web内容/WEB-INF/web.xml:
<web-app (…) >
(...)
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
(…)
</web-app>