开发者

What is the simplest apache mod_proxy configuration for Glassfish?

I have a server with Apache2 (on port 80) and Glassfish (on port 8080). I'd like to configure Apache to transparently proxy al request to a certain virtual host to the glassfish Server.

I tried this, but it doesen't work:

<VirtualHost *>
ServerName tognettiimmobiliare.com
ServerAlias www.tognettiimmobiliare.com

ProxyRequests on

<Proxy *>
Order de开发者_运维问答ny,allow
Allow from all
</Proxy>

ProxyPreserveHost On

ProxyPass / http://tognettiimmobiliare.com:8080/tognettiWEB/
ProxyPassReverse / http://tognettiimmobiliare.com:8080/tognettiWEB/

</VirtualHost>

Can anybody tell me why? Thanks


I am proxying Jenkins and Redmine from a different port with mod_proxy, my configuration looks something like this, sans an additional <Proxy> part which I believe is not needed:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyPass /jenkins/ http://localhost:8080/jenkins/
ProxyPassReverse /jenkins/ http://localhost:8080/jenkins/

ProxyPass /redmine/ http://localhost:81/redmine/
ProxyPassReverse /redmine/ http://localhost:81/redmine/

There are two things to keep in mind:

  • The context needs to be the same in both proxy and proxied URLs, like /jenkins/ and .../jenkins/

  • You should not use external URLs for the proxied page because it will then try to route out to the internet and connect from there, this is slow and firewalls might block the port. Use local machine names or IPs.


I use a simple VirtualHost like so which works.

<VirtualHost *:80>
#   ServerName www.itmanx.com

    ProxyPass / http://www.itmanx.int/
    ProxyPassReverse / http://www.itmanx.int/
</VirtualHost>

make sure you have mod_proxy and mod_proxy_http loaded


I enabled JK on Glassfish by going to Configurations -> server-config -> HTTP Service -> Http Listeners -> jk-listener and enabled it.

Then set up the in my Apache config to proxy this way so the SSL data also gets transmitted.

<Location /util>
SSLOptions +StdEnvVars +ExportCertData
ProxyPass ajp://localhost:8004/util
</Location>

One caveat though, mod_proxy_wstunnel does not seem to work with this or at least I haven't found out how to yet since I use WSS and https://issues.apache.org/bugzilla/show_bug.cgi?id=55320 needs 2.4.10 which is not released yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜