Apache & Tomcat: ProxyPass and ProxyPassReverse

后端 未结 7 1908
眼角桃花
眼角桃花 2021-01-31 20:44

I\'am having troubles configuring Apache and Tomcat, this is the scenario:

I have an Apache Web Server, running and working normally, I can access to this one just typin

相关标签:
7条回答
  • 2021-01-31 20:59

    Service not available might be coming due to SELinux ,try disabling SE Linux : setenforce 0

    0 讨论(0)
  • 2021-01-31 21:02

    Try this:

    ProxyPass /prueba/ http://localhost:8009/prueba/
    ProxyPassReverse /prueba/ http://localhost:8009/prueba/
    

    and then hit the following URL from browser: http:// localhost/prueba/

    note: it is mandatory to add "/prueba/"

    0 讨论(0)
  • 2021-01-31 21:10

    ProxyPassReverse defines the URL Apache httpd should rewrite the URLs to, which would redirect to the proxied (hidden) URL. Because of this, you should change your ProxyPassReverse line to something like this:

    ProxyPassReverse / http://localhost/prueba/
    

    See also: http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html#usage

    0 讨论(0)
  • 2021-01-31 21:11

    You stated: I can access typing:

    http://localhost:8080/prueba

    but the following does not work:

    ProxyPass /prueba/ http://localhost:8009/prueba/

    8080 != 8009

    make sure your port numbers are the same

    0 讨论(0)
  • 2021-01-31 21:15

    you may try adding:

    ProxyPreserveHost On
    

    From the documentation:

    "When enabled, this option will pass the Host: line from the incoming request to the proxied host, instead of the hostname specified in the ProxyPass line.

    This option should normally be turned Off. It is mostly useful in special configurations like proxied mass name-based virtual hosting, where the original Host header needs to be evaluated by the backend server."

    0 讨论(0)
  • 2021-01-31 21:18

    You have to put

     ProxyPass / ajp://localhost:8009/
     ProxyPassReverse / ajp://localhost:8009/
    

    on your apache virtual host

    Then you have to uncomment ajp listener in tomcat

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

    Then you have to configure host and context path in server.xml

    REFF: http://www.ntu.edu.sg/home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html

    Hope this will help you..

    0 讨论(0)
提交回复
热议问题