【问题标题】:How to configure tomcat java application in apache web server?如何在 apache Web 服务器中配置 tomcat java 应用程序?
【发布时间】:2017-04-12 22:33:59
【问题描述】:

我刚刚在apache中配置了tomcat java应用程序,如下所示。

<VirtualHost *:80>
    ServerName domain.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/app_name
    ProxyPassReverse / http://localhost:8080/app_name
</VirtualHost>

后来我使用a2ensite adavipalem.conf 启用了站点并重新启动了服务器。

当我尝试通过点击像 >> domain.com 从浏览器访问 我在浏览器中得到了类似下面的内容。

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.7 (Ubuntu) Server at adavipalem.com Port 80

谁能帮我在哪里更改此配置?

问候,

【问题讨论】:

  • httpd 的error.log 或Tomcat 的catalina.out 有错误吗?

标签: java apache tomcat web


【解决方案1】:

我自己解决了这个问题。前面提到的config没有问题..

<VirtualHost *:80>
    ServerName domain.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/app_name
    ProxyPassReverse / http://localhost:8080/app_name
</VirtualHost>

我只是忘了启用

a2enmod proxy_http

因此,我无法发出 HTTP 请求,最终我被困在 apache 本身。后来我启用了proxy_http,现在它正在代理我到tomcat url,我现在可以引用tomcat应用了。

谢谢

【讨论】:

    猜你喜欢
    • 2010-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 2020-05-29
    • 1970-01-01
    相关资源
    最近更新 更多