简体   繁体   English

Tomcat前面的Apache无法正常工作

[英]Apache in front of Tomcat not working

I am using the following example file: https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/ and have deployed it on Tomcat. 我正在使用以下示例文件: https : //tomcat.apache.org/tomcat-7.0-doc/appdev/sample/并将其部署在Tomcat上。

I want to put Apache in front of Tomcat. 我想把Apache放在Tomcat的前面。 I have the following config on my Tomcat's server.xml: 我在Tomcat的server.xml上具有以下配置:

    <Connector port="8081" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />

<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

My Apache is running on port 80, and my workers.properties looks as follows: 我的Apache在端口80上运行,我的worker.properties如下所示:

worker.list=jboss,tomcat

worker.jboss.port=8009
worker.jboss.host=127.0.0.1
worker.jboss.type=ajp13

worker.tomcat.port=8010
worker.tomcat.host=127.0.0.1
worker.tomcat.type=ajp13

Note that I also have JBoss running. 请注意,我也正在运行JBoss。 Then my uriworkermap.properties looks as follows: 然后,我的uriworkermap.properties如下所示:

/App/*=jboss
/sample/*=tomcat
/sample=tomcat
/sample/=tomcat

The JBoss config works fine. JBoss配置工作正常。 If I go to http://localhost:8081/sample/ my webpage is displayed. 如果我转到http:// localhost:8081 / sample /,则会显示我的网页。 But if I go to http://localhost:80/sample/ I get a The Webpage cannot be found error. 但是,如果我转到http:// localhost:80 / sample /, 则会收到“找不到网页”错误。 What am I doing wrong? 我究竟做错了什么?

This is what http://localhost:8081/sample/ looks like: 这是http:// localhost:8081 / sample /的样子: 在此处输入图片说明

you can't run a java app on apache web server. 您无法在apache网络服务器上运行Java应用。 you need a servlet container like tomcat to run a java app. 您需要像tomcat这样的servlet容器来运行Java应用。 If you want to use apache as a gateway to your app deployed at tomcat, you can have some static file or cgi script in your apache server and that script or html file could call your app deployed at tomcat. 如果要使用apache作为tomcat部署的应用程序的网关,则可以在apache服务器中包含一些静态文件或cgi脚本,并且该脚本或html文件可以调用已部署在tomcat的应用程序。 URL http://localhost:80/sample/ is not working because it's expecting a file name sample in your apache's www (usually) directory and your probably don't have that file in there. URL http:// localhost:80 / sample /不起作用,因为它期望在您的Apache的www(通常)目录中有一个文件名示例,并且您可能没有该文件。

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

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