简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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