如何在apache web服务器中配置tomcat java应用程序?

时间:2016-11-29 03:25:10

标签: java apache tomcat web

我刚刚在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启用了网站并重新启动了服务器。

当我尝试通过点击&gt;&gt;来从浏览器访问时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

任何人都可以帮我,我应该在哪里更改此配置?

此致

1 个答案:

答案 0 :(得分:1)

我自己解决了这个问题。我之前提到的配置没有问题..

<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应用了。

由于