在apache服务器和tomcat之间设置代理的问题

发布于 2024-12-18 02:47:45 字数 1461 浏览 3 评论 0原文

我一直在尝试设置一个网络代理来重定向到位于

http://example.com 的 tomcat 应用程序:8085/应用程序。但我无法让它发挥作用。

<VirtualHost XXX.XXX.XXX.XX:80>
    ServerName example.com

    ServerAlias www.example.com

    ProxyRequests Off

    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass /app http://localhost:8085/app
    ProxyPassReverse /app http://localhost:8085/app

    #ProxyPass / ajp://localhost:8085/ (tried this as well)
    #ProxyPassReverse / ajp://localhost:8085/ (tried this as well)

    <Location />
        Order allow,deny
        Allow from all
    </Location>

    #DocumentRoot /home/groupname/public_html (apache location - dummy)

    DocumentRoot /usr/local/tomcat/apache-tomcat-6.0.33/webapps/app (tomcat location)

</VirtualHost>

以下是 server.xml 文件中的配置。

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

    <Engine name="Catalina" defaultHost="localhost">

    <Host name="localhost"  appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">

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

现在这就是我正在尝试做的事情。当我输入 www.example.com 或 example.com 时,我想转到该应用程序。有人可以指出我做错了吗?

I have been trying to set up a web proxy to redirect to the tomcat app which is located at

http://example.com:8085/app . But I am not able to get it to work.

<VirtualHost XXX.XXX.XXX.XX:80>
    ServerName example.com

    ServerAlias www.example.com

    ProxyRequests Off

    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass /app http://localhost:8085/app
    ProxyPassReverse /app http://localhost:8085/app

    #ProxyPass / ajp://localhost:8085/ (tried this as well)
    #ProxyPassReverse / ajp://localhost:8085/ (tried this as well)

    <Location />
        Order allow,deny
        Allow from all
    </Location>

    #DocumentRoot /home/groupname/public_html (apache location - dummy)

    DocumentRoot /usr/local/tomcat/apache-tomcat-6.0.33/webapps/app (tomcat location)

</VirtualHost>

Following is the configuration from the server.xml file.

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

    <Engine name="Catalina" defaultHost="localhost">

    <Host name="localhost"  appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">

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

Now this is what I am trying to do. When I type www.example.com or example.com I want to go to the app. Can someone give me pointers as to that I am doing wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

許願樹丅啲祈禱 2024-12-25 02:47:45

您需要 mod_jk 或类似的东西来在 tomcat 和 apache 之间建立真正的连接。

尝试 这个

那里的代理设置更多的是为了隐藏端口号

You'll need mod_jk or something similar to do the real connection between tomcat and apache.

Try this

The proxy settings up there is more aimed for hiding the port number

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文