In order to pass traffic to JBoss/TomCat on port 80 using Apache we used to install and configure mod_jk.
Is there an equivalent for nginx? Basically want all port 80 traffic to be passed to jboss.
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
For nginx checkout their docs here. Proxy support is built in. In the example below from their site, you will see that specific port 80 traffic is being sent to a single servlet container running on port 8080. Note that if you want to run multiple backend servlet containers ( for load balancing, scaling, etc... ) you should look at the Upstream Fair Module that will send traffic to the least-busy backend server. It is not shipped by defaul w/nginx.
| |||
feedback
|
|
Another way to do it like it's described in LikeApache wiki page.
I have as well tested it as well with /myapp instead of root and works as well, putting location /myapp and proxypass http://myapp:8080/myapp; As well, this configuration maps everything to the Java application, which is useful when you have nice URLs that are mapped by an MVC framework like Struts. | |||
|
feedback
|
|
You can check my blog post on configuring Nginx as reverse proxy for Tomcat. It may be interesting to you, as example includes few additional tweaks as caching content only for not logged in users and redirecting for different languages. | |||
|
feedback
|
|
You don't have to use mod_jk, you can use mod_proxy, i.e. pass the traffic through over HTTP instead of AJP. If nginx has proxy ability, that should work just as well. | |||||
feedback
|
|
There is now a pretty fresh ajp_module for nginex. I dont have experience with it, but I think the session stickyness and especially the persistent backend connections are quite helpfull for Tomcat. Both methods (http proxy or ajp proxy) are sadly inflexible for longrunning queries (comet) or large file transfers (uploads). https://github.com/yaoweibin/nginx_ajp_module#readme lighthttp BTW has a general proxy module which can handle FCGI,HTTP,CGIS and AJP13 encodiung. This looks like a better approach (but I think from reading it has the same limitations with regards to untypical long/large request/response patterns). | |||
|
feedback
|