简体   繁体   English

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

[英]issues with setting up proxy between apache server and tomcat

I have been trying to set up a web proxy to redirect to the tomcat app which is located at 我一直在尝试设置Web代理以重定向到位于以下位置的tomcat应用程序

http://example.com:8085/app . 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. 以下是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" />

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. 当我输入www.example.com或example.com时,我想转到该应用程序。 Can someone give me pointers as to that I am doing wrong. 有人可以指出我做错了什么吗?

You'll need mod_jk or something similar to do the real connection between tomcat and apache. 您需要mod_jk或类似的东西才能在tomcat和apache之间建立真正的联系。

Try this 试试这个

The proxy settings up there is more aimed for hiding the port number 那里的代理设置更旨在隐藏端口号

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

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