Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Nginx and WebSphere Last updated: August 28, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

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.

nginx-market-share

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

was-nginx

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 {
            ip_hash;
        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 {
            ip_hash;
        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.

  • Chandan Kumar
    Author
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on Nginx
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder