How to Use Nginx with WebSphere Application Server?

IBM WAS (WebSphere Application Server) usually go with IBM HTTP Server, However; then this quick guide will help you.

IHS is based on Apache HTTP server, and it works, but when it comes to performance, then nothing beat Nginx web server.

Nginx market share is gradually increasing in top million busiest sites.

Let’s see what it takes to integrate Nginx with IBM WAS. The following is demonstrated in Linux environment.

I assume you have installed WAS & Nginx. If not, here is quick guide to installing Nginx

  • Login into Web Server
  • Install using following commands
yum install epel-release
yum install nginx

Few things to note when using Nginx.

  • You don’t need to use the WebSphere Plug-in. Instead, we will use proxy_pass
  • You can either forward all request to WebSphere or by context root in location directive
  • You need to specify all JVM host and port manually in Nginx configuration file

Let’s get it started…

  • Login to Nginx server
  • Take a backup of nginx.conf file (/etc/nginx/nginx/conf in default installation location)
  • Add the following upstream under http block
upstream wasservers {
        server localhost:9080;
        server localhost:9081;

In above example, I am creating an upstream backend called “wasservers” and have configured two JVM. You can configure as many as you need.

Note: if your WAS server is different than Nginx then you got to ensure necessary ports are allowed in the firewall.

Next, I will instruct Nginx to forward all request to a newly created wasservers backend.

  • Add the following proxy_pass under location  block
proxy_pass http://wasservers;
  • it should look like this
        location /
        proxy_pass http://wasservers;
        proxy_set_header Host $host;
  • Restart the Nginx web server
service nginx restart

Let’s verify by accessing WAS application through Nginx listening address

So you can see I got cachemonitor application opened through Nginx.

This is very basic configuration to get IBM WAS integrated with Nginx as front-end web server.

You may also be interested in exploring additional Nginx configuration like;

Configuring load balancing – you can setup a load balancing to distribute request based on client IP. This would be useful or necessary if you have multiple JVM’s and want to persist the connection.

This is possible by adding ip_hash in an upstream module. For ex:

upstream wasservers {
        server localhost:9080;
        server localhost:9081;

Taking WAS JVM out – if you have configured multiple JVM’s and for some reason one of them are having an issue, then you have two options.

Either you delete the JVM server: port from an upstream module or leverage down parameter to temporarily disable the request forwarding.

For ex:

upstream wasservers {
        server localhost:9080;
        server localhost:9081 down;


If you are looking for advanced configuration like session affinity, health checks, etc., hen you got to use Nginx Plus.

I hope this short note give you an idea how to implement Nginx as a web server in front of IBM WAS. You may also refer to IBM official guide for more details.

Leave a Comment

Your email address will not be published. Required fields are marked *